The SAS Output Delivery System and reporting techniques

Creating several different ODS outputs from a PROC FREQ

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Creating several different ODS outputs from a PROC FREQ

Dear all:

I just joined the community and I hope to learn and share with you as much as possible.

I have one question to start:

I need to create as many reports as categories are in the BY statement of a PROC FREQ (there will be around 30), and export the PDF output as an individual PDF file (this is, one PDF file for each category in the BY statement).

So far, I've come to this syntax, which exports only an aggregated file instead of for each category in the BY statement:


ODS PDF STYLE=Styles.SASweb FILE='C:\S1_out.pdf';

PROC FREQ DATA=WORK.Labels_Export_CMS;
TITLE "Finalized Cases";
TABLES
IntervierName*DispositionCode / nocol nopercent;
WHERE status=2;
BY Supervisor;
RUN;

ODS PDF CLOSE;

Ideally, I would need to do this as efficient as possible (hopefully, not making one syntax as the one above for each of the 30 cases), since I'll need to generate this information from the same database (same structure, new information), weekly.

Thank you very much.

Rafa


Accepted Solutions
Solution
‎11-13-2013 12:29 PM
Grand Advisor
Posts: 16,348

Re: Creating several different ODS outputs from a PROC FREQ

Try the newfile=bygroup option in the ODS PDF statement. I don't know if theres's a way to control the filename though.

proc sort data=sashelp.class out=class;

by sex;

run;

ods pdf file="C:\_LocalData\Summary.pdf" style=seaside newfile=bygroup;

proc freq data=class;

by sex;

table age;

run;

ods pdf close;

View solution in original post


All Replies
Solution
‎11-13-2013 12:29 PM
Grand Advisor
Posts: 16,348

Re: Creating several different ODS outputs from a PROC FREQ

Try the newfile=bygroup option in the ODS PDF statement. I don't know if theres's a way to control the filename though.

proc sort data=sashelp.class out=class;

by sex;

run;

ods pdf file="C:\_LocalData\Summary.pdf" style=seaside newfile=bygroup;

proc freq data=class;

by sex;

table age;

run;

ods pdf close;

New Contributor
Posts: 2

Re: Creating several different ODS outputs from a PROC FREQ

Thank you very much! This works just fine for what I need to do.

I can work around a way to solve the name issue (since it is sorted, I could link the variable name given by the newfile=bygroup statement with the actual value in a separate table). If I find a SAS solution to it, I'll post it here as well.

:smileygrin:

SAS Super FREQ
Posts: 8,645

Re: Creating several different ODS outputs from a PROC FREQ

Hi, when you use NEWFILE=, the names are always numbered versions of the original FILE= value. You can't control the names, unless you "macro-ize" your code to supply a specific name.

cynthia

Post a Question
Discussion Stats
  • 3 replies
  • 364 views
  • 1 like
  • 3 in conversation