BookmarkSubscribeRSS Feed
mmea
Quartz | Level 8

Hi. I have this code for a proc report:

ods pdf notoc file="F:\TEST.pdf" ;
options orientation=landscape;

TITLE1 j=l color=STEEL bold 'XXXXX' ;
TITLE2 j=l color=black bold  'XXXXX';
options mprint;
proc format;
    /*value pctf .='N/A' waittime percentn10.  low-<0.1= 0.1-high=waittime format=percentn10.*/;
    value colorf .=white low-<0.1=Firebrick 0.1-high=lightblue;
run;

%macro many_col;
    proc sql noprint;
        select count(distinct dato) into :ncols from pdf1;
    quit;
    %put &=ncols;
	proc report data=pdf1 style(header) = {background = lightgray color = black};
	    columns region place metode dato,waittime ;
	    define Region/group style(header) = {background = lightgray color = black font_weight=bold font_face=calibri } style(column) = {background = lightgray color = black font_weight=bold font_face=calibri Cellwidth=70};
	    define place /group style(header) = {background = lightgray color = black font_weight=bold font_face=calibri} style(column) = {background = lightgray color = black font_face=calibri };
		define metode/group '' style(header) = {background = lightgray color = black font_weight=bold font_face=calibri} style(column) = {background = lightgray color = black font_face=calibri};
	    define dato/across order=internal format= ddmmyyd10. style(header) = {background = lightgray color = black font_weight=bold font_face=calibri};
	    define waittime /sum format=percentn10./*format=pctf5. */'';
	    compute waittime ;
	          %do i=1 %to &ncols;
	               call define("_c%eval(&i+3)_",'style','style={background=colorf. color=black font_face=calibri font_weight=bold}');
	          %end;
	      endcompute;
		
	run;
%mend;

%many_col

ods pdf close;

My report shows titles in all pages, but I only need it on the first page - how can I do so?

Second question: My report comes out very long because a have a set of dates across the table in the output which do not fit in PDF on a single page or two - I tried to correct the cellwidth on the other group variables, but if I change to cellwidth=20, then it will look good in the result window - but come out messy in the PDF.

Is there any tips and tricks to make the final output prettier?

 

 

4 REPLIES 4
PhilC
Rhodochrosite | Level 12

Have you worked with PROC ODSTEXT?

 

I don't know if you might tweak the font size/style to your liking...

/*TITLE1 j=l color=STEEL bold 'XXXXX' ;*/
/*TITLE2 j=l color=black bold  'XXXXX';*/
proc odstext;
  p 'XXXXX' /style=[color=steel font_weight=bold fontsize=16pt];
  p 'XXXXX' /style=[color=black                  fontsize=14pt];
run;
Cynthia_sas
SAS Super FREQ

Hi,

  One way to keep using the SAS TITLE statement and only having titles on the first page is to use OBS= and FIRSTOBS= - -as shown with SASHELP.CARS:

Cynthia_sas_0-1608655266304.png

 

This paper talks about how to make wide output fit in the PDF destination. You can change font, cellpadding and other attributes to make output fit better: https://support.sas.com/resources/papers/proceedings14/SAS038-2014.pdf

 

  Hope this helps,

Cynthia

mmea
Quartz | Level 8

Hi is it possible to get titles on the first page only and on another specific page also?

so the title should appear two times in the report?

I have 2 different proc reports that I outout in 1 PDF, and on the first page I want a title as you showed - it worked, but then I want a title when the second report starts

 

is that possible

 

 

 

Cynthia_sas
SAS Super FREQ
Hi:
If you look at the code example in my picture, I have a null TITLE statement:
TITLE;
which "blanks out" all of the current titles. If you want to change the title between reports or when the next report starts, you'd just need to use a title statement immediately before the steps where you want a title. My example showed how to get a title on page 1, but then no title on page 2 and subsequent pages by using 2 PROC REPORT steps: 1 step for the first page, with a title and 1 step for the rest of the report using FIRSTOBS= and OBS= to control where the second page started. If you will be having another report after this, then just use a new TITLE statement before THAT report step.
Cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 785 views
  • 0 likes
  • 3 in conversation