Programming Efficiency

0

In one of my previous posts, I challenged myself to use SAS to create a monthly household budget and I’m happy to report that I have started this process. I have a few months worth of data and have begun to merge this information into data sets.

With the combination of chapter 8 (Creating Enhanced List & Summary Reports) and chapter 9 (Producing Description Statistics) from the Certification Prep Guide, I have been able to produce a few basic reports using PROC MEANS and PROC FREQ. There’s still some tweaking to do, as I don’t think there’s quite that much being spent on some of the categories, but it’s a starting block to build upon.

One of the challenges I’m also finding is that (as with most things in life) there are many ways to create a program with the same end results. But, there are definitely ways that are more efficient and a clearer way to program. I’m guessing as I continue to program these will become more obvious to me. But, here is an example from An Array of Challenges: Test Your SAS Skills:

This program creates a frequency table based on the first four observations of PARTNO. Make the program more efficient by eliminating the SUBSTR function. What other major efficiencies could you introduce?

Data Justfour;
Set Parts;
Part4 = SUBSTR (PARTNO, 1, 4);

PROC FREQ data = Justfour;
Tables Part4;

According to the author, the most efficient way is to eliminate the DATA step entirely for the program below.

Proc FREQ Data=parts;
Tables PARTNO;
Format PARTNO $4.;

Here’s to happy and efficient SAS Programming!

Share

About Author

Christine Kjellberg

Sr Associate Development Tester

Related Posts

Leave A Reply

Back to Top