Help using Base SAS procedures

Proc Report and Format with Overlapping Ranges

Reply
Occasional Contributor BNG
Occasional Contributor
Posts: 10

Proc Report and Format with Overlapping Ranges

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!
SAS Super FREQ
Posts: 8,864

Re: Proc Report and Format with Overlapping Ranges

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]
Occasional Contributor BNG
Occasional Contributor
Posts: 10

Re: Proc Report and Format with Overlapping Ranges

Thanks Cynthia, your suggestion is very useful!
Ask a Question
Discussion stats
  • 2 replies
  • 170 views
  • 0 likes
  • 2 in conversation