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)
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;
ODS ESCAPECHAR function {THISPAGE} to insert page number and macro function %sysfunc (today()) to insert date in the same title line.
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
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
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
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.
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}"
@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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.
Ready to level-up your skills? Choose your own adventure.