As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Best Practices: Use Coding Shortcuts to Avoid Typsos and Add Flexibility

From sasCommunity
Jump to: navigation, search

by Mary F. O. Rosenbloom and Kirk Paul Lafler

ABSTRACT Let‟s face it: typos happen. Although the Enhanced Editor makes it easy to see when important elements in data and procedural steps are mistyped, there is no way to check for spelling errors in variable name specifications. In fact, even one mistyped character can bring down an entire analysis suite if we are unlucky enough. Certainly there is no substitute for careful checking of one‟s own code and rigorous validation. However, a number of techniques exist that can be used to minimize the chance of a typing error. When specific best practice techniques are combined with carefully chosen variable names (where possible), the amount of typing is often reduced, the program becomes more flexible to data changes, and the likelihood of a typo is diminished. This paper takes a quick look at several of these techniques, such as the colon wildcard, use of the dash for specification of sequential variable names, use of DIM with arrays, and #BYVAL and #BYVAR in titles.

This paper was presented in the Coder's Corner section at the Western Users of SAS Software (WUSS) 2012 Conference in Long Beach, California.


We look forward to your comments!