BookmarkSubscribeRSS Feed
mmkr
Quartz | Level 8

Hi,

Can some one help me to dsiplay report like below .

 

I am looking for Page Number , Title and datestamp on same line (left,center,right)

mmkr_0-1718735921648.png

 

 

7 REPLIES 7
A_Kh
Lapis Lazuli | Level 10

We can use just title statement with justification = left/center/right option followed by desired text string.
eg;

options nodate nonumber;
ods escapechar='~';
ods pdf file='test.pdf';
	title1 j=l 'Page No:~{thispage}' j=c 'Title line 1: Country' j=right "Datestamp:%sysfunc(today(), mmddyy10.)";
	title2 j=l 'Report Name: Report 1' j=c 'Title line 2: State';
	title3 j=c 'Title line 3: Country';
	proc report data=sashelp.cars;
		where type= 'SUV' and msrp gt 50000;
		column origin make model msrp;
	run; 
ods pdf close;

Capture.PNG
ODS ESCAPECHAR function {THISPAGE}  to insert page number and macro function %sysfunc (today()) to insert date in the same title line.  

Cynthia_sas
SAS Super FREQ

Hi:

  This should get you started. If you want the information about Country, State and County to change, then you'll need to investigate using #byval in your TITLE statements, but this shows how to get basic strings into your TITLEs justified as you showed:

Cynthia_sas_0-1718738773312.png

Cynthia

 

mmkr
Quartz | Level 8

Thank you so much  , one more request how do i put it in one line if Title is little big ?

 

Example : Title Name : This is the Report of weekly learning and implement 

 

Page No : 1      This is the Report of weekly learning and                  Datestamp : 10/12/2024

                              implement 

 

"Implement" word is going in to second line but i need it one line 

There is a space avaiable in between rigth and left of the center justify 

 

Cynthia_sas
SAS Super FREQ

Hi:

  This Tech Support note suggests reducing the font size of moving to multiple title statements: https://support.sas.com/kb/24/492.html and that is the only thing I can think of to suggest. You might want to work with SAS Tech Support on this question to see whether they have any other suggestions.

Cynthia

ballardw
Super User

Sometimes you have to decide which is more important.

 

You could set the page orientation to landscape to make a wider than tall document.

options orientation=landscape;

prior to the ODS PDF destination would work.

 

One other alternate approach which may not "work" if you want to print the document on paper is to define a different paper size to make a page wider if your desired font size will not fit.

 

The SAS system option PAPERSIZE set before creating a document will do such.

 

options papersize=(10in, 10in);

would use a logical page that is 10 inches by 10 inches. Or what size may work. As I said above, this may result in a document that is not paper friendly, either not fitting or looking out of place depending on the particular papersize and text displayed.

Don't forget to set back to your default, likely LETTER or A4 depending on local afterwards.

mmkr
Quartz | Level 8

Thank you one more question !!

 

Page no i can display on left side : 

Title1 j=l "Report Page No:~{thispage}"

 

How do i display on right side with by variable page no ?

 

For exmple if i have total 50 pages , in proc report i have by variable called ID and contents of page is coming ID's which is unique by 4 Id's

 

I want to reset page no's when ever ID chnages 

 

so iam looking for code something like 

 

Title1 j=l "Total Report Page No:~{thispage}"

    j=r "By Variable Page No:~{thispage}" 

 

ballardw
Super User

@mmkr wrote:

Thank you one more question !!

 

Page no i can display on left side : 

Title1 j=l "Report Page No:~{thispage}"

 

How do i display on right side with by variable page no ?

 

For exmple if i have total 50 pages , in proc report i have by variable called ID and contents of page is coming ID's which is unique by 4 Id's

 

I want to reset page no's when ever ID chnages 

 

so iam looking for code something like 

 

Title1 j=l "Total Report Page No:~{thispage}"

    j=r "By Variable Page No:~{thispage}" 

 


MAY be possible if the Report is using a BY statement. Then you can use the #BYVAR and/ or #BYval special values in a title.

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!

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
  • 7 replies
  • 696 views
  • 0 likes
  • 4 in conversation