10 Steps to Easier SAS Code Maintenance

NESUG 2011
Link:
http://www.nesug.org/Proceedings/nesug11/cc/cc10.pdf
Abstract:
Part of the author’s job at is to produce on a yearly basis a number of rates used in national healthcare quality surveys and accreditation performance measures. Each year when the revised specs came out, she got tired of having to update processes manually, hunting through programs for diagnosis codes and dates that needed to be changed, copying and pasting the same updates and code blocks so many times she lost count, and then inevitably finding out she’d missed a spot when the program either bombed, or – worse – ran all the way through but returned last year’s data instead of this year’s or outdated diagnosis codes. Then when the revisions to the revisions came out and those revised revisions begot new revisions as well, she had to keep going through the same tedious process.

This paper describes how to make yearly code maintenance tasks easier in 10 steps, using simple organization techniques, appropriate documentation, macro variables, and parameterized macros.
1. Break large processes into smaller steps.
2. Number programs.
3. Document using comments.
4. Document using program headers.
5. Create an initial startup program.
6. Create a final cleanup program.
7. Use macro variables for date selection criteria.
8. Use macro variables for file naming.
9. Use parameterized macros for similar processes.
10. Use macro variables for long lists that need frequent updating/referencing.