I'll admit it - I'm often impatient while waiting for results, so my code needs to run as fast as possible! In this video, I show you how you can get faster results, too.
I'll demonstrate several different techniques that produce identical results, and compare processing speeds. For a more robust assessment, I'll test the techniques while reading from both SAS data sets and database tables. Analysis of the results clearly shows that when the techniques produce identical results, these choices usually produce faster run times:
- Use a WHERE statement instead of a subsetting IF statement.
- Use the KEEP= dataset option on input data sets instead of a KEEP statement.
- Should I use SQL or DATA step?
- If producing a single result, use SQL.
- If producing multiple results, use the DATA step.
- If your process is CPU bound:
- If you have access to CAS, run it in CAS.
- Otherwise, refactor in DS2.
The programs I used to create the video are available for download from GitHub if you want to experiment.
Until next time, may the SAS be with you!