As a simple example to learn Multilabel formats, let's suppose I want to use SASHELP.CLASS to determine average height amongst 11-13 year olds, and amongst 12-14 year olds;
proc format;
value agefmt (multilabel) 11-13='11-13' 12-14='12-14';
run;
proc summary data=sashelp.class(where=(age<=14));
var height;
class age;
output out=_stats_ mean=;
format age agefmt.;
run;
Works as expected. Now suppose I also want to have one more average computed by the same PROC SUMMARY, where I want the mean of just 13 year olds.
proc format;
value agefmt (multilabel) 11-13='11-13' 12-14='12-14' 13-13='13';
run;
proc summary data=sashelp.class(where=(age<=14));
var height;
class age;
output out=_stats_ mean=;
format age agefmt.;
run;
This does not produce an average for just 13 year olds.
Am I doing something wrong? Or am I misunderstanding the functionality of MULTILABEL formats? (Yes, I know I can get this from two PROC SUMMARY calls, but I really would like to understand the MULTILABEL format)
Ah, that seems to do it. It sure would be nice if the PROC FORMAT documentation mentioned that, but it doesn't. Thanks, @Tom
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.