BookmarkSubscribeRSS Feed
RussellAlmeida
Calcite | Level 5
Hi,

Version: SAS 9.1.3
Operating System : AIX
Procedure: ODS PDF with Proc Report.

I have a report where i have to print dynamic values in the report header, this is easily done using the #ByVal feature.

My requirement is the following
Country :<#ByVAL1>.............................State :
District :<#ByVAL3>.............................Village:

ie
Field1: VAL1--------------------------------------Field2 : VALUE2
Field3: VAL2--------------------------------------Field4 : VAL4

The values should come one under the other, i have applied style with the option Justify = l, c, r but then the values dont fall one below the other

Please suggest

Regards
Russell Message was edited by: Russell Almeida
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Share the code you are using which doesn't work to meet your needs.

Scott Barry
SBBWorks, Inc.
Cynthia_sas
SAS Super FREQ
Hi:

Any 2 Title statements will not "line up" with each other because by default the font for PDF is a proportional spaced font, in which the letter 'i' will take up less space in the title area than the letter 'w'.
For example...consider the following 2 lines of 20 'i' and 20 'w' characters each followed by 5 spaces and then the same text:
iiiiiiiiiiiiiiiiiiii It is going to snow.
wwwwwwwwwwwwwwwwwwww It is going to snow.

Because the 20 'i' characters take up less space on a line with a proportional font, the string "It is going to snow" on the first line will never line up with the same text on the second line -- by default. That is the nature of proportional fonts.

In addition, the SAS Title will rarely "line up" with the report columns in the main report area with PROC REPORT because the Title text is styled with a larger font than the font used for the headers or data cells.

I also do not understand what you mean by saying that you are achieving your results using #BYVAL...you show the '#' for #BYVAL1 and #BYVAL3, but not for BYVAL2 and BYVAL4 -- so I doubt that you are getting accurate results.

If you could show an example of your code and an example of some data, that would be very useful. This previous forum posting is very useful in understanding how to post code snippets in order to maintain the indenting and any special characters:
http://support.sas.com/forums/thread.jspa?messageID=27609毙

cynthia
RussellAlmeida
Calcite | Level 5
Hi Cynthia, Scott,

The code as requested.

Code
================================
/*============================================================*/
/* Search for NOBYLINES to address the problem for this report*/
/*============================================================*/




options nobyline nonumber linesize=100 pagesize=60 nocenter nodate;

ODS PATH work.templat(update) sasuser.templat(read)
sashelp.tmplmst(read);

proc template;
define style border;
parent=Styles.Printer;
replace table from table /
borderwidth=0.0
;
replace header from header /
background=grayff;
end;
run;

/* Calculate the sysdate value in the format requireda and store */
/* it in the macro variable to be used in the TITLE statement */
data _null_;
call symput('_sysdate',put(input("&sysdate.",date7.),ddmmyyp10.));
run;

ODS _ALL_ CLOSE;
*FILENAME EGPDF 'test.pdf';
*ODS PDF(ID=EGPDF)
FILE=EGPDF
NOTOC
STYLE=border ;
ods pdf file="RD035.pdf" notoc style = border;

;
ods escapechar ='~';

title1
justify = c font=Helvetica height=9pt bold '#ByVal1' ;

title2
justify = l font=arial height=8pt '#ByVal2 '
justify = r font=arial height=8pt "Utskriftsdato: &_sysdate. kl &systime. side ~{thispage} av ~{lastpage} ";
title3;
title4
justify = l font=arial height=8pt '#byval3'
justify = r font=arial height=8pt 'Reolnr: #byval4';
title5
justify = l font=arial height=8pt 'Ehnet: #byval5'
justify = r font=arial height=8pt 'Romnr: #byval6';

title6
justify = l font=arial height=8pt 'RUTENR: #byval7';

title7 '_____________________________________________________________________________________';



footnote1 ;
footnote2;
footnote3;
footnote4;
footnote5;
footnote6;
footnote7;


proc report data = VL0608_106R_Sat_closed_mailbox nowd spacing = 30 wrap ls=100
style(summary)={htmlstyle="border-top:solid;border-bottom:solid"} split='*';

By Report_Name Report_Id Title_Line2 Rack_Id Organization_Long_Nm Room_Id Route_Id;
column
Report_Name
Report_Id
Title_Line2
Rack_Id
Organization_Long_Nm
Room_Id
Route_Id
Stop_Nm
Stop_Site_Id
Mailbox_attr
Party_name
Adress_Nm_long

;

define Report_ID/group noprint;
define Report_name/group noprint;
define title_Line2/noprint;

define Rack_Id/group noprint;
define Organization_Long_Nm/group noprint;
define Room_Id/group noprint;
define Route_Id/group noprint;

define Stop_Nm/order left "STOPNAVN"
style(column)=[cellwidth=100pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define Stop_Site_Id/ order left "ST NR"
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;


define Mailbox_attr/ display left "L NR"
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define Party_name/ display left "NAVN"
style(column)=[cellwidth=150pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define Adress_Nm_long/ display left "ADRESSE"
style(column)=[cellwidth=200pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;
break after Stop_Nm/skip ol suppress;

compute after Stop_Nm;
line ' ';
endcomp;
run;


ODS _all_ close;

================================

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1275 views
  • 0 likes
  • 3 in conversation