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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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