The SAS Output Delivery System and reporting techniques

ODS PDF

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 87
Accepted Solution

ODS PDF

I'm trying to print text into pdf document. I've provided example below. Can you please suggest how I can achieve this?

 

ods pdf file = "/folder1/checks_report.pdf" style=custom_matth notoc;

 

data _null_;

put "Check1 has &check1.ed";
put "This month Volume is &this_mon_vol";
put "Mean Volume of last 12 months trend is &mean_volume";
put "Std Deviation of last 12 months trend is &std_volume";
put "Lower limit for volume is &lower_limit_volume";
put "Upper limit for volume is &upper_limit_volume";

run;

 

ods pdf close;
run;

 

I want the below result in a pdf.

 

Check1 has passed
This month Volume is 22346
Mean Volume of last 12 months trend is 17982
Std Deviation of last 12 months trend is 3297
Lower limit for volume is 11388
Upper limit for volume is 24576


Accepted Solutions
Solution
‎07-18-2016 12:34 PM
Super User
Super User
Posts: 7,997

Re: ODS PDF

Use proc print or proc report on the dataset:

ods pdf file...;
data temp;
  text="Check..."; output;
  text="This month..."; output;
...
run;
proc print data=temp;
run;
ods pdf close;

You can fiddle around with proc print or proc report options to remove labels and such like.

View solution in original post


All Replies
Solution
‎07-18-2016 12:34 PM
Super User
Super User
Posts: 7,997

Re: ODS PDF

Use proc print or proc report on the dataset:

ods pdf file...;
data temp;
  text="Check..."; output;
  text="This month..."; output;
...
run;
proc print data=temp;
run;
ods pdf close;

You can fiddle around with proc print or proc report options to remove labels and such like.

Frequent Contributor
Posts: 87

Re: ODS PDF

It works as I expected. Thanks!

 

However is there a way I could suppress variable name to be shown on the report? In below report check1 is my variable name which is printing. I would like not to display that. 

 

 

Check1

check1
Check1 has PASSED
 
This Month Volume is 22346
Mean Volume for last 12 months is 17982
Std Deviation of Volume for last 12 months is 3297
Lower limit for volume is 11388
Upper limit for volume is 24576
 
 
 
 
 
 

 

SAS Super FREQ
Posts: 8,868

Re: ODS PDF

Hi:
If you use PROC REPORT, it has the NOHEADER option, which will suppress the column headers. If you use PROC PRINT then you will have to settle for just turning the label off with a LABEL statement, but the header cell will still be there.

cynthia
Frequent Contributor
Posts: 87

Re: ODS PDF

Posted in reply to Cynthia_sas

Thank you!

 

I'm trying 3 proc reports in ods pdf. Each proc report is printing in different page. I need all of them to print in a single page. Is it possible?

 


ods pdf file = "/folder1/checks_report1.pdf" style=custom_matth notoc;

 

 proc report data=check1 nowd noheader;
title 'Check1';
define check1 / style=[font_weight=bold font_size=14pt];
column check1;
run;

proc report data=check2 nowd noheader;
title 'Check2';
define check2 / style=[font_weight=bold font_size=14pt];
column check2;
run;

proc report data=check3 nowd noheader;
title 'Check3';
define check3 / style=[font_weight=bold font_size=14pt];
column check3;
run;


ods pdf close;
run;

 

SAS Super FREQ
Posts: 8,868

Re: ODS PDF

Hi:
Investigate the STARTPAGE=NO option for ODS PDF.
cynthia
Frequent Contributor
Posts: 87

Re: ODS PDF

Posted in reply to Cynthia_sas

Thank you!  It works. But, now its printing only 1 title. The first title. I would like to have all 3 titles and their tables listed in 1 page.

 


ods pdf startpage=YES;

proc report data=check1 nowd noheader;
title 'Check1';
define check1 / style=[font_weight=bold font_size=14pt];
column check1;
run;

ods pdf startpage=NO;

proc report data=check2 nowd noheader;
title 'Check2';
define check2 / style=[font_weight=bold font_size=14pt];
column check2;
run;

ods pdf startpage=NO;

proc report data=check3 nowd noheader;
title 'Check3';
define check3 / style=[font_weight=bold font_size=14pt];
column check3;
run;


ods pdf close;
run;

SAS Super FREQ
Posts: 8,868

Re: ODS PDF

Hi:
Yes, PDF is fairly sticky about titles. A page only has 1 title. So the title for the first procedure step wins and gets the top of the page.

Since you are using PROC REPORT, you could add this to each PROC REPORT step, instead of a title:
compute before _page_;
line "Check ??";
endcomp;

And that would put the string you want BEFORE each table. Or, you could use ODS TEXT= before each of the PROC REPORT steps...the only downside of ODS TEXT= is that you'll have to fiddle to get the formatting the way you want.

There are ways around what's happening, but the TITLE statements are not used with ODS PDF when you use STARTPAGE=NO.
http://support.sas.com/techsup/notes/v8/8/044.html shows one approach and this Tech Support notes shows another approach with text between tables: http://support.sas.com/kb/43/259.html

cynthia
Super User
Posts: 10,046

Re: ODS PDF

ods pdf file = "/folders/myfolders/checks_report.pdf" style=sasweb notoc;
data _null_;
file print;
put "Check1 has &check1.ed";
put "This month Volume is &this_mon_vol";
put "Mean Volume of last 12 months trend is &mean_volume";
put "Std Deviation of last 12 months trend is &std_volume";
put "Lower limit for volume is &lower_limit_volume";
put "Upper limit for volume is &upper_limit_volume";
run;
ods pdf close;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 389 views
  • 0 likes
  • 4 in conversation