Dear All,
Can anyone please guide on how to handle only single subject data per page in proc report ?
Regards,
Rajesh
Use the PAGE option on a BREAK AFTER statement.
Hi Tom,
I have used that option and i am looking for alternate also where i can use some macro variables and populate the subject id in the header part/title of page.
Hi,
I used below but not working as per my requirement.
data a;
input x $ score ;
datalines;
a 1
a 2
a .
a 3
a 4
b .
b 4
b 4
b 6
b .
;
proc sql;
create table aa as select distinct x from a;
select distinct x into :n_1-:n_&sqlobs from a;
quit;
%let N = &sqlobs;
%macro headache;
%do i=1 %to &N;
%put &&n_&i;
proc sql;
create table report as select score from a where x="&&n_&i";
quit;
data re;
set report;
sn+1;
run;
title "report for &&n_&i";
ODS PDF FILE="D:\Practice\test.pdf";
proc report data=re nowd;
column sn score;
define sn /order ;
define score/style(column)={just=left};
run;
ods _all_ close;
%end;
%mend;
%headache;
So ideally this should print two pages in output but it print only single page and that is for last subject only.
I have observed that macro is overwriting the observations.Please guide.
Hi,
Can anyone please guide and tweak the attached code for me.
In this, Proc report is overwriting previous subject observation and poduce only one page.
I need two page in that report
In your macro, the statement
ODS PDF FILE="D:\Practice\test.pdf"
recreates test.pdf every time the macro is called. That means each time you call the macro the macro overwrites the previous version of the file. Remove this statement from your macro and put it just before you run the macro.
You may want to look at BY processing with the #BYLINE and #BYVAL to modify the title.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.