Tips:Using Variable List Abbreviations as Function Arguments

From sasCommunity
Jump to: navigation, search
ave = mean(of month1-month12);  /* numbered name list */
call missing(of months{*});     /* array reference */
total = sum(of month:);         /* name prefix list */
variance = var(of b-numeric-a); /* name range list */
misscnt = nmiss(of _numeric_);  /* special name list */

For functions that expect a list of arguments, like most of the statistics functions, you can use variable list abbreviations instead of listing each variable individually. The caveat; you must precede the list abbreviation with the keyword OF.

Remember the OF. Without it you will get an error (if you are lucky) or incorrect results (if you are not so lucky). These variable list shortcuts create what is essentially a space separated list of variables, and unless the OF keyword is present, functions expect a comma-separated list.



....read more

....see also

Submitted By Art Carpenter (talk)