BookmarkSubscribeRSS Feed
BNG
Calcite | Level 5 BNG
Calcite | Level 5
From what I knew, to create a self-defined format with overlapping ranges (multilabel formats), we can use the MULTILABEL option in the VALUE statement in PROC FORMAT.

However, the multilabel formats can only apply on the three procedures namely PRCO TABULATE, PROC MEANS and PROC SUMMARY (NOT INCLUDE PROC REPORT).

I was wondering whether there are some ways or options that the multilabel formats can be applied in PROC REPORT.

Any advice you can give would be appreciated!
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
You are correct that only PROC TABULATE and MEANS/SUMMARY will use multi-label formats. (The doc:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#/documentation/cdl/en... )

So, you just can't use MLF with PROC REPORT directly, but what a lot of folks do is either manipulate the data before PROC REPORT to add extra observations for counting or reporting (not my first choice) or create an output dataset with either MEANS or TABULATE and then use that summary dataset in PROC REPORT.

See the example below where I create the WORK.MLFOUT dataset from PROC TABULATE and then use that dataset with PROC REPORT.

cynthia
[pre]
proc format;
value drv (multilabel)
15-16='driver'
11-14= 'non-driver'
11-12 ='preteen'
13-19 = 'teen';
run;

ods listing close;
ods html file='c:\temp\usemlf.html' style=sasweb;
proc tabulate data=sashelp.class out=work.mlfout(rename=(n=count));
title 'TABULATE creates output dataset';
class age / mlf;
class sex;
format age drv.;
table sex,
age;
run;

proc report data=mlfout nowd;
title 'REPORT uses output dataset from TABULATE with MLF';
column sex count,age;
define sex / group;
define age /across;
define count / ' ';
run;

ods html close;
[/pre]
BNG
Calcite | Level 5 BNG
Calcite | Level 5
Thanks Cynthia, your suggestion is very useful!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1896 views
  • 0 likes
  • 2 in conversation