BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
mmkr
Quartz | Level 8

Iam looking for report like below , 

2nd page always should be signature page like below 

By variable is Age 

let's say i have 35,40,45 ages so it should be total 6 pages 

3 pages of data and 3 pages of signature pages

but 2nd page should be always a signature page like below 

 

 

     

Page No :1

Title "Report Page1" by Age 35

     

Name

Age

Sex

   

Tom

35

M

   

Martin

35

M

   

Sophie

35

F

   
         
         
       

Page No : 2

         

I here by confirm ---------Signature above report is correct

         
         
         
       

Page No : 3

         

Title "Report Page1" by Age 40

     

Name

Age

Sex

   

Stephine

40

M

   

Don

40

M

   

Thomas

40

M

   
         
         
       

Page No : 4

         

I here by confirm ---------Signature above report is correct

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Nope. Make a macro to generate the code I showed, not using BY statement.

 

proc sort data=sashelp.class out=output;by age;run;
proc freq data=output noprint;
table age/out=age;
run;

%macro report(age=);
proc report data=output nowd;
where age=&age.;
run;
ods pdf startpage=now;
proc odstext;
p 'Signature: ________________'/style={fontsize=8 just=r};
run;
%mend;


ods pdf file='c:\temp\temp.pdf' notoc;
options nodate nonumber;
title j=r ' PageNo:(*ESC*){thispage} ';

data _null_;
 set age;
 call execute(catt('%report(age=',age,')'));
run;

ods pdf close;

View solution in original post

9 REPLIES 9
data_null__
Jade | Level 19

Maybe something like this with signature at the bottom of the page.

 

proc report data=sashelp.class;
   columns age name sex height weight;
   define age / order;
   break after age / page;
   compute after age / style(lines)=[just=r];
      line ' ';
      line 'Signature: ________________';
      endcomp;
   run;

Capture.PNG

 

 

mmkr
Quartz | Level 8

i want completely in to the second page 

mmkr
Quartz | Level 8

Iam looking for report like below , 

2nd page always should be signature page like below 

By variable is Age 

let's say i have 35,40,45 ages so it should be total 6 pages 

3 pages of data and 3 pages of signature pages

but 2nd page should be always a signature page like below 

 

 

     

Page No :1

Title "Report Page1" by Age 35

     

Name

Age

Sex

   

Tom

35

M

   

Martin

35

M

   

Sophie

35

F

   
         
         
       

Page No : 2

         

I here by confirm ---------Signature above report is correct

         
         
         
       

Page No : 3

         

Title "Report Page1" by Age 40

     

Name

Age

Sex

   

Stephine

40

M

   

Don

40

M

   

Thomas

40

M

   
         
         
       

Page No : 4

         

I here by confirm ---------Signature above report is correct

ChrisNZ
Tourmaline | Level 20

Like this?

 

options nodate nonumber;
ods escapechar='^';
ods pdf file="~/test.pdf";
%macro report;
  %local i;
  %do i=11 %to 16;
	ods pdf startpage=now;
	title j=r 'Page ^{thispage} of ^{lastpage}' j=c "Report for age &i";
	proc print noobs data=SASHELP.CLASS; 
	  where AGE=&i.;
	run;  
	ods pdf startpage=now;
	title  j=r 'Page ^{thispage} of ^{lastpage}' ;
	ods text="^S={just=c topmargin=5cm}I hereby confirm --------- the above report for age &i is correct.";
	ods text="^S={just=c rightmargin=2cm}Signature";
  %end;
  ods _all_ close;
%mend; 
%report

This creates page 1:

 

ChrisNZ_0-1719291233912.png

page 2:

ChrisNZ_1-1719291260824.png

etc

 

 

Ksharp
Super User

Use PROC ODSTEXT instead.


 
ods rtf file='c:\temp\temp.rtf' ;
options nodate nonumber;
title j=r ' PageNo:(*ESC*){thispage}   ';
proc report data=sashelp.class nowd;
where age=14;
run;
ods rtf startpage=now;
proc odstext;
p 'Signature: ________________'/style={fontsize=8 just=r};
run;

ods rtf startpage=now;
proc report data=sashelp.class nowd;
where age=15;
run;
ods rtf startpage=now;
proc odstext;
p 'Signature: ________________'/style={fontsize=8 just=r};
run;

ods rtf startpage=now;
proc report data=sashelp.class nowd;
where age=16;
run;
ods rtf startpage=now;
proc odstext;
p 'Signature: ________________'/style={fontsize=8 just=r};
run;
ods rtf close;

 

mmkr
Quartz | Level 8

Below is the updated code :

 

Iam getting signature page on only last page , but i need it for every by variable 

proc sort data=sashelp.class out=output;by age;run;

ods pdf file='c:\temp\temp.pdf' ;
options nodate nonumber;
title j=r ' PageNo:(*ESC*){thispage} ';

proc report data=output nowd;by age;

ods pdf startpage=now;
proc odstext;
p 'Signature: ________________'/style={fontsize=8 just=r};
run;
ods pdf close;

Ksharp
Super User

Nope. Make a macro to generate the code I showed, not using BY statement.

 

proc sort data=sashelp.class out=output;by age;run;
proc freq data=output noprint;
table age/out=age;
run;

%macro report(age=);
proc report data=output nowd;
where age=&age.;
run;
ods pdf startpage=now;
proc odstext;
p 'Signature: ________________'/style={fontsize=8 just=r};
run;
%mend;


ods pdf file='c:\temp\temp.pdf' notoc;
options nodate nonumber;
title j=r ' PageNo:(*ESC*){thispage} ';

data _null_;
 set age;
 call execute(catt('%report(age=',age,')'));
run;

ods pdf close;
mmkr
Quartz | Level 8

Thanks so much , it worked as i needed

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 1001 views
  • 1 like
  • 5 in conversation