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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1295 views
  • 0 likes
  • 2 in conversation