Seven steps for avoiding (data) hangovers

1

In a production environment, where dozens of SAS programs are run in sequence, often monthly or quarterly, and where logs can span thousands of lines, it’s easy to overlook the small stuff that can cause data hangovers.  Recognize any of these?

  • A temporary data set finds its way into subsequent programs (this can also happen with macros and global macros ...)
  • You ran all 30 of your programs, reviewed the log, and then forgot to save it …
  • You ran your programs and just overwrote the output from last quarter …
  • You just sent the wrong output to your customer! 

Is your head starting to hurt yet? At the Western Users of SAS Software (WUSS) conference in San Francisco, Mary Rosenbloom kindly offered up some simple housekeeping techniques you can use to avoid hangovers, slip-ups and other programming headaches.

Rosenbloom’s core message was “clean house” with good programming style, meaning:

  • Using meaningful variable and routine names.
  • Good program structure.
  • Straightforward and easily understandable code techniques.
  • Clear code layout (or visual structure).
  • Minimization of control-flow.

Steps to clean house:

  1. Use PROC DATASETS to Clear Temp Datasets at the End of a Program
  2. Use PROC CATALOG to Delete Unwanted Macro Programs
  3. Use %SYMDEL to Delete Unneeded Global Macro Variables
  4. Use DM Statements to Save the Log
  5. Save and restore startup (initialized) system options
  6. Use X Commands to Zip your Output
  7. Email the Results using SAS

For step-by-step instructions for each of the seven tips above, check out Rosenbloom’s paper, co-authored with Kirk Paul Lafler: Best practices: Clean house to avoid hangovers.


These code examples are provided as is, without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.

Share

About Author

Anne-Lindsay Beall

Senior Editor

Anne-Lindsay Beall is a writer and editor for SAS. Since joining the company in 2000, Anne-Lindsay has edited print publications, Web sites, customer success stories, blogs and digital publications. She has a bachelor’s degree in English from the University of North Carolina at Chapel Hill and a master’s degree in English from North Carolina State University. You can find her on LinkedIn at: www.linkedin.com/in/annelindsaybeall

Related Posts

Back to Top