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.
Tip of the Day:July 8
sasCommunity Tip of the Day
proc format; value age (multilabel notsorted) 11='11' 12='12' 11-12='Pre-Teen' 13='13' /* 14='14' */ /* values not in the format are excluded from the output */ 15='15' /* 16='16' */ /* values not in the format are excluded from the output */ 13-16='Teen' 11-16='All'; run; proc summary data=sashelp.class nway; class name age/mlf; id sex height weight; format age age.; output out=expanded(drop=_type_ _freq_); run;
Multivalue formats as illustrated in this PROC REPORT example can be quite useful to create reports with multiple overlapping groups. But only a few procedures support such formats.
However you can trick it by using a multivalue format to expand a data creating duplicate rows. This can be useful if you want to run other procedures like PROC UNIVARIATE or do other calculations like counting unique occurrences.
The code at the right illustrates a way to use multilabel formats to create duplicate rows for later analysis. This can be a nice alternative to writing your own code to do, for example, Cartesian products.
The basic idea is to run PROC SUMMARY with the NWAY option where one of the class variables uniquely identifies each input row. In this example, we want to associate each age value with multiple groups. In this case, the variable name uniquely identifies each observation and multiple output observations are created for each of assigned values of age in the format. Since no VAR statement is included, the observations are output/duplicated as is.
Feel free to comment on this tip.