3 of 30: Tricks for reducing CPU time

Do you remember when CPU time was a high-priced commodity? "Today, if you are any good at what you do, the constrained resource is you," says Timothy Berryhill from Wells Fargo. Berryhill has years of experience with SAS on "many platforms and operating systems." He says there are several things you can do to save your time - and your company's money.

According to Berryhill, there are two very important things you can do to make the best of your time and those who look at your code later: Make sure your code is clear and correct. "To me, the main thing is correct. If the answers are wrong, it doesn't matter how you got there," he says.

Here are three of his tried-and-true tips:

"I like to use the %LET, particularly at the top of my code where variables are going to change," says Berryhill. He use a series of the %LET at the top of the program to remind him of changes he needs to make.

The NOBS option tells you how many observations you have in a dataset. According to Berryhill, the option is most useful when NOBS is 0. "If you try to do a PROC PRINT or a global dataset, you set that empty dataset, and Boom you're gone. (This only works for disk files, not views or tapes.)"

Try your luck. When he isn't on a tight deadline, Berryhill says that he likes to experiment with code just to see if it works. Recently, he found that the double question mark will suppress expected errors in the input function. "I was surprised to find out that it is also supported in a statement."

Read 27 more of Berryhill's SAS tricks in his paper, "30 in 20 things you may not know about SAS."

3 of 30: Tricks for reducing CPU time was published on SAS Users.