The SAS Output Delivery System and reporting techniques

ODS PDF Using Proc Report

Accepted Solution Solved
Reply
Regular Contributor
Posts: 222
Accepted Solution

ODS PDF Using Proc Report

Hi....I am trying to create a report in pdf and proc report to generated the data and table for the output. I have attached a word document on how I would like each page to look like and having difficulty in inserting the title, footnote and repeated header on top of each page. Any suggestions and help would be greatly appreciated.....Thanks


Accepted Solutions
Solution
‎05-28-2015 02:38 PM
SAS Super FREQ
Posts: 8,743

Re: ODS PDF Using Proc Report

Your title requirements can be achieved with SAS title statements. They are not tied to PROC REPORT. Here's the first page of the output produced by the code below.

Cynthia

exam_title.png

options nodate nonumber;
 
ods pdf file='c:\temp\spec_header_titles.pdf';
title bold h=14pt 'The First Title';
title2 j=l 'Client Name' j=r "&sysdate";
title3 j=l 'More Stuff'  j=r "Something";

 

proc print data=sashelp.class;
run;

 

proc report data=sashelp.class nowd;
run;

 

proc tabulate data=sashelp.class;
class age;
var height weight;
table age all,
      (height*n mean) weight*(min max);
run;
ods pdf close;

View solution in original post


All Replies
Super User
Super User
Posts: 7,401

Re: ODS PDF Using Proc Report

Simplest way is to use a by group:

proc report data = xyz...;

     title 4 "Client Name: #byval1     Report Date From: #byval2";

     by client_name...;

...

Super User
Posts: 10,496

Re: ODS PDF Using Proc Report

May I say that your dates in the example look a little odd? 201500430

I get that 2015 would be a year but are you using 3 digits for a month?

Regular Contributor
Posts: 222

Re: ODS PDF Using Proc Report


Hi Ballardw....thank you for pointing that out....it was error....it should of been 20150430 as I was just creating a template of what I would like the output file to look like.

Solution
‎05-28-2015 02:38 PM
SAS Super FREQ
Posts: 8,743

Re: ODS PDF Using Proc Report

Your title requirements can be achieved with SAS title statements. They are not tied to PROC REPORT. Here's the first page of the output produced by the code below.

Cynthia

exam_title.png

options nodate nonumber;
 
ods pdf file='c:\temp\spec_header_titles.pdf';
title bold h=14pt 'The First Title';
title2 j=l 'Client Name' j=r "&sysdate";
title3 j=l 'More Stuff'  j=r "Something";

 

proc print data=sashelp.class;
run;

 

proc report data=sashelp.class nowd;
run;

 

proc tabulate data=sashelp.class;
class age;
var height weight;
table age all,
      (height*n mean) weight*(min max);
run;
ods pdf close;

Regular Contributor
Posts: 222

Re: ODS PDF Using Proc Report

Hi Cynthia......Thank you so much. I tried something similar to your example but am still having problems with including a macro variable (for example, &rundate that I had defined) with either the title or footnote statements. I don't believe I enclosed the macro variable in double quotes but will try that and see if that resolves the problem. One other think, is it possible to insert a line after title3 and above the first footnote.

Super User
Posts: 9,676

Re: ODS PDF Using Proc Report

Try style:

ods pdf file='c:\temp\x.pdf' style=journal;

Regular Contributor
Posts: 222

Re: ODS PDF Using Proc Report


Hi Xia Keshan....I am using style=journal. I would like to insert a line across the page that would separate the Titles from the Table. I am wondering would I have to use the BORDERBOTTOM?

Super User
Posts: 9,676

Re: ODS PDF Using Proc Report

NO. Try this one:

ods pdf file='c:\temp\x.pdf' style=journal;
title 'xxxxxxxx';
proc report data=sashelp.class nowd style(header)={borderbottomcolor=white};
columns name age;
define name/style(column)={bordertopcolor=white};
define age/style(column)={bordertopcolor=white};
run;
ods pdf close;

x.png

Xia Keshan

SAS Super FREQ
Posts: 8,743

Re: ODS PDF Using Proc Report

Hi:

  This output was created with the changed code below (using the TITLE statement).

Cynthia

add_line.png

%let rstr = %str( );

%let tstr = %sysfunc(repeat(&rstr,50));

 

ods escapechar='^';

  

ods pdf file='c:\temp\spec_header_titlesx.pdf';

title bold h=14pt '1 The First Title';

title2 j=l 'Client Name' j=r "&sysdate";

title3 j=l 'More Stuff'  j=r "Something";

title4 "^{style[bordertopwidth=2px bordertopcolor=black] &tstr}";

Regular Contributor
Posts: 222

Re: ODS PDF Using Proc Report


Thanks Cyntia...Works perfectly!!!

☑ This topic is SOLVED.

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

Discussion stats
  • 10 replies
  • 1042 views
  • 3 likes
  • 5 in conversation