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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

10 REPLIES 10
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Simplest way is to use a by group:

proc report data = xyz...;

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

     by client_name...;

...

ballardw
Super User

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?

twildone
Pyrite | Level 9


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.

Cynthia_sas
SAS Super FREQ

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;

twildone
Pyrite | Level 9

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.

Ksharp
Super User

Try style:

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

twildone
Pyrite | Level 9


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?

Ksharp
Super User

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

Cynthia_sas
SAS Super FREQ

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}";

twildone
Pyrite | Level 9


Thanks Cyntia...Works perfectly!!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 10 replies
  • 2175 views
  • 3 likes
  • 5 in conversation