BookmarkSubscribeRSS Feed
sk81
Calcite | Level 5

I am creating a PDF with two proc reports, one for the title information and other for the report. I am displaying each break value variable info on a separate page.

Everything goes right if there is only one page per break variable value. But if there are multiple pages, the proc report (titles) does not display on the second page.

Is there any solution to this problem ? Or using a proc report for displaying titles is not a good idea at all?

Please help.

6 REPLIES 6
ArtC
Rhodochrosite | Level 12

Why are you using two separate REPORT steps?  Combining them into a single step might solve the problem.  Seeing a bit more code or your output might help us to assess.

Cynthia_sas
SAS Super FREQ

Hi:

  SAS has global title and footnote statements. They work with ANY procedure. You specify them with TITLE and FOOTNOTE statements like:

TITLE1 'This is Title1';

TITLE2 'This is Title2';

FOOTNOTE1 'My footnote';

  PROC REPORT does not have a separate "title" statement. So I am confused when you say: "But if there are multiple pages, the proc report (titles) does not display on the second page." If you used SAS TITLE statements, you should get a title on EVERY page. Since PROC REPORT does not have a title, this statement doesn't tell me anything to explain your issue. There a few things that might impact titles, but since you didn't show any code, as Art said, it's impossible to comment.

  If your code or data is proprietary and you cannot post it, then this would be a question that is best answered by Tech Support.

cynthia

sk81
Calcite | Level 5

Hi,

Actually, my basic problem is I have too much stuff in the title part that should be displayed for all the pages of the report. With compute block I am not getting proper alignment in ods pdf. so I used PROC report for soem of the titles part.

Basically I want to achieve the following things which are not working right now:

1. Both left and right alignments in a single line statement(compute block) which is not happening so I used proc report.

2. I want result for each 'make' on separate page.

3. Also the header block (with name,address info) should appear on each page just below the titles.

My Code goes somewhat like below:

PROC SQL;
CREATE TABLE header1(TEXT1 CHAR(30),  TEXT2 CHAR(30),  TEXT3 CHAR(30));
INSERT INTO header1
SET TEXT1="Name:..... ",   TEXT2="text....",    TEXT3="macro variable..."
SET TEXT1="Contact no.......",   TEXT2="text......",     TEXT3="macro variable..."
SET TEXT1="Adress1...... ",  TEXT2="text...",   TEXT3="text...."
SET TEXT1="Adress2..........",  TEXT2="text...",   TEXT3="text...."
SET TEXT1="text",     TEXT2="text...",   TEXT3="text....";
RUN;

ods pdf file="C:\Users\sxkamtekar\Desktop\xyz.pdf"  startpage=no;
ods escapechar="^";

TITLE1 JUSTIFY=CENTER font=ARIAL height=8pt "Title1" HEIGHT=8PT JUSTIFY=RIGHT "PAGE#:       ^{thispage}";
TITLE2  JUSTIFY=CENTER FONT=ARIAL HEIGHT=8PT "Title2";
TITLE3 JUSTIFY=CENTER FONT=ARIAL HEIGHT=8PT "Title3" HEIGHT=8PT JUSTIFY=RIGHT "Run Date: %sysfunc(date(),MMDDYY8.)"; 
TITLE4 " ";
TITLE5 JUSTIFY=CENTER FONT=ARIAL HEIGHT=8PT "Title5";
TITLE6 JUSTIFY=CENTER FONT=ARIAL HEIGHT=8PT "Title6";
TITLE7 " ";


PROC REPORT DATA=header1 noheader NOWD
STYLE(REPORT)=[RULES=NONE CELLPADDING=1 bordercolor=LIGHTgrey borderwidth=0.5 FONT_FACE=arial  ]
STYLE(COLUMN)=[FONT_FACE=ARIAL FONT_SIZE=8PT ];

COLUMN text1 text2 text3;

DEFINE text1 / display style(column)=[just=left cellwidth=2in];
DEFINE text2 / display style(column)=[just=left cellwidth=1.5in];
DEFINE text3 / display style(column)=[just=left cellwidth=1.5in];

RUN;


proc report data=sashelp.cars  (obs=35)
STYLE(REPORT)=[RULES=NONE CELLPADDING=1 frame=void FONT_FACE=arial font_size= 8pt ]
STYLE(COLUMN)=[FONT_FACE=ARIAL FONT_SIZE=8PT ];

COLUMN make model type origin msrp;

DEFINE make / group STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
DEFINE model / DISPLAY STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
DEFINE type / DISPLAY STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left]; 
DEFINE origin / DISPLAY STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
DEFINE msrp / sum STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
break after make / page summarize suppress STYLE=[FONT_WEIGHT=BOLD];

run;

ods pdf close;

--- Arya

Cynthia_sas
SAS Super FREQ

Hi:

  The issues I see with your approach are these:

1) Using STARTPAGE=NO is not a good approach with PDF if you need the SAS titles to be on top of every table. Essentially, if you want a new page for every MAKE, using the BREAK option, then STARTPAGE=NO is turning off that option. Doesn't make sense.

  

2) Even if your idea putting the names into a PROC REPORT as pseudo titles would work as you envision (I don't think it will), macro variables are only resolved at COMPILE time, so your values would not change from the first time the macro variable values were set.

   

3) I can make a report look like it has 20 titles, just using TITLE statements. See the code below.

 

4) It concerns me that you said your code looks "somewhat" like below. It is futile to spend time trying to help or make suggestions with "somewhat" code. It's always nice to have REAL code and REAL data to do a test with.

  

5) It was my understanding that Adobe did not like a specification of plain Arial (the Microsoft font)...that the best practice was to either use Helvetica with PDF or use the Adobe version of Arial, which is specified as font='Arial Unicode MS'

6) you can do multiple alignments of text strings in a TITLE or FOOTNOTE statement, but the LINE output in a COMPUTE block is one continuous text string, you have to use spaces to pad the strings and even then, with a proportional spaced font, you won't generally get one line to be exactly lined up under another line.

7)  Are you trying to generate the same report once for each person? Or??? What is the purpose of the Address block. Is this like a form letter?

cynthia


ods pdf file="C:\temp\xyz.pdf"  ;

 
ods escapechar="^";

 

** escapechar+n is the "line feed" or "carriage return" or "new line" instruction;

 

TITLE1 J=CENTER font=Helvetica h=8pt "Title1" h=8PT J=RIGHT "PAGE#:       ^{thispage}";
TITLE2  J=CENTER FONT=Helvetica h=8PT "Title2";
TITLE3 J=CENTER FONT=Helvetica h=8PT "Title3" h=8PT J=RIGHT "Run Date: %sysfunc(date(),MMDDYY8.)"; 
TITLE4 " ";
TITLE5 J=CENTER FONT=Helvetica h=8PT "Title5";
TITLE6 J=CENTER FONT=Helvetica h=8PT "Title6";
TITLE7 " ";
title8 J=CENTER FONT=Helvetica h=8PT 'Title8';
title9 J=CENTER FONT=Helvetica h=8PT 'Title9';
title10 J=LEFT FONT=Helvetica h=8PT 'Title10 ^nline11^nline12^nline13^nline14^nline15^nline16^nline17^nline18^nline19^nline20';
   
proc report data=sashelp.cars nowd
   STYLE(REPORT)=[RULES=NONE CELLPADDING=1 frame=void FONT_FACE=Helvetica font_size= 8pt ]
   STYLE(COLUMN)=[FONT_FACE=Helvetica FONT_SIZE=8PT ];
where make in ('Audi','Acura');
  
COLUMN make model type origin msrp;
   
DEFINE make / order STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
DEFINE model / DISPLAY STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
DEFINE type / DISPLAY STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left]; 
DEFINE origin / DISPLAY STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
DEFINE msrp / sum STYLE(COLUMN)=[CELLWIDTH=1IN JUST=left];
break after make / page summarize suppress STYLE=[FONT_WEIGHT=BOLD];

run;

ods _all_ close;

sk81
Calcite | Level 5

Cynthia,

I think using line feed should solve my problem of displaying more than 10 titles. and then I can even use macro variables inside the title statements and also the jsutification. I always had this feeling that using PROC report for displaying titles was never a good idea. Just could not foresee the issues with it.

Thanks for your comments. Appreciate your help.

Arya

Cynthia_sas
SAS Super FREQ

Hi:

  Well you were right. PROC REPORT's COMPUTE block with the LINE statement should never be considered a substitute for SAS titles. The COMPUTE block text stays within the boundary of the table, while the title text spans from margin to margin (in destinations that support margins). And what you write with the COMPUTE block may or may not repeat at the start of every page. For example, your PROC REPORT with pseudo titles would only appear in front of the first table, and NOT on every page. I have used a technique similar to yours to put a cover page on a report -- but never to simulate titles.

  Good luck with your report.

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 22575 views
  • 0 likes
  • 3 in conversation