BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
helloSAS
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

8 REPLIES 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

helloSAS
Obsidian | Level 7

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
 
 
 
 
 
 

 

Cynthia_sas
SAS Super FREQ
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
helloSAS
Obsidian | Level 7

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;

 

Cynthia_sas
SAS Super FREQ
Hi:
Investigate the STARTPAGE=NO option for ODS PDF.
cynthia
helloSAS
Obsidian | Level 7

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;

Cynthia_sas
SAS Super FREQ
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
Ksharp
Super User
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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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