user3489870
user3489870

Reputation:

Separate report pages when printed out-sas

I have a sas output, and for each person have some information. But each person is supposed to be on a separate page when printed out, in other words that PDF should be one page for each person. I didn't use macro in my code. Also I don't know how to make macro. So is there any way that I can separate pages without using macro?

Code:

data _null_;
set maingroup;
 call execute('%bygroup(' || trim(maingroup) || ')');
run;

This code separate the people for each page. But I don't have macro, I changed the code little bit. Check the report as below.:

 Ayda Ceyhan: 325
  1258    458
 Grade:3.0
 Issues: Test
  -------
 Justin Costay: 526
 1568   132 
 Grade:3.5
 Issues: NA

This is the output, there are two people in here. I need them to separate for each page when print out.

Upvotes: 1

Views: 663

Answers (1)

Joe
Joe

Reputation: 63424

This depends largely on your actual report; but in general, you should be able to use by groups rather than using macros.

A simple example:

ods pdf file="c:\temp\test.pdf" startpage=bygroup;
proc report data=sashelp.class nowd;
by name;
columns age sex height weight;
run;
ods pdf close;

The startpage=bygroup tells the PDF engine to print out a new page for each by group. You might need to use notsorted if your by variable cannot be sorted on. This may or may not exactly do what you want, depending on how you're producing the report.

If you're doing this with data step programming, you may have a harder time without having access to the macro that's doing it. I honestly wouldn't use data step programming; nowadays, proc report/tabulate/etc. are very good at producing reports in whatever format you want, and they're much more powerful than data step programming.

In your specific simple example, you may be able to issue ods pdf startpage=now; commands via call execute (and then use startpage=never on the original ods pdf statement).

Upvotes: 2

Related Questions