Hi! Is there a way to work an equivalent of #byval() into the "compute before _page_" part of PROC REPORT? It seems that #byval and #byvar only works for TITLE statements. TIA.
data example;
input name $ num;
datalines;
Bob 12
Jill 19
Bob 23
Jill 40
;
proc sort; by name; run;
options nobyline;
proc report data=example nowd;
by name;
/* title "#byval(name)";*/
column name num;
compute before _page_ / style=header{just=l};
line "#byval(name)";
endcomp;
run;
Never mind. Further Googling helped me to figure it out. I already figured out keeping the bottom border. But how do I insert the top border to make the tables look like these?
proc template;
define style styles.test1;
parent=styles.printer;
style fonts /
'TitleFont' = ("Albany AMT",13pt,bold)
'TitleFont2' = ("Albany AMT",13pt,bold)
'StrongFont' = ("<MTserif>, Times Roman",10pt,bold)
'EmphasisFont' = ("Calibri",10pt,bold)
'FixedEmphasisFont' = ("<MTmonospace>, Courier",9pt,italic)
'FixedStrongFont' = ("<MTmonospace>, Courier",9pt,bold)
'BatchFixedFont' = ("SAS Monospace, <MTmonospace>, Courier",6.7pt)
'FixedFont' = ("<MTmonospace>, Courier",9pt)
'headingFont' = ("<MTserif>, Times Roman",11pt,bold)
'docFont'=("Albany AMT",10pt)
;
style systemtitle from TitlesAndFooters /
just=center
vjust=center
;
style Body from Document /
marginbottom = 0.5in
margintop = 0.5in
marginright = 0.25in
marginleft = 0.25in;
style Table from Output /
frame=below
rules = none
borderspacing=0
borderwidth=0.5pt
borderstyle = solid
font=fonts('docFont')
;
style header from table /
just=right
vjust=middle
fontsize=11pt
fontweight=bold
background=white
;
class cell /
paddingleft=1pt
paddingright=1pt
;
end;
run;
data example;
input name $ num;
datalines;
Bob 12
Jill 19
Bob 23
Jill 40
;
run;
ods pdf file="example.pdf" notoc style=styles.test1;
proc report data=example nowd;
column name num;
define name / order order=internal format=$4.;
break after name / page;
compute before _page_ / style=header{just=l};
line name $4.;
endcomp;
run;
ods pdf close;
Never mind again. Figured adding "style(header)=[bordertopwidth=0.5pt bordertopcolor=black]" did the trick.
proc template;
define style styles.test1;
parent=styles.printer;
style fonts /
'TitleFont' = ("Albany AMT",13pt,bold)
'TitleFont2' = ("Albany AMT",13pt,bold)
'StrongFont' = ("<MTserif>, Times Roman",10pt,bold)
'EmphasisFont' = ("Calibri",10pt,bold)
'FixedEmphasisFont' = ("<MTmonospace>, Courier",9pt,italic)
'FixedStrongFont' = ("<MTmonospace>, Courier",9pt,bold)
'BatchFixedFont' = ("SAS Monospace, <MTmonospace>, Courier",6.7pt)
'FixedFont' = ("<MTmonospace>, Courier",9pt)
'headingFont' = ("<MTserif>, Times Roman",11pt,bold)
'docFont'=("Albany AMT",10pt)
;
style systemtitle from TitlesAndFooters /
just=center
vjust=center
;
style Body from Document /
marginbottom = 0.5in
margintop = 0.5in
marginright = 0.25in
marginleft = 0.25in;
style Table from Output /
frame=below
rules = none
borderspacing=0
borderwidth=0.5pt
borderstyle = solid
font=fonts('docFont')
;
style header from table /
just=right
vjust=middle
fontsize=11pt
fontweight=bold
background=white
;
class cell /
paddingleft=1pt
paddingright=1pt
;
end;
run;
data example;
input name $ num;
datalines;
Bob 12
Jill 19
Bob 23
Jill 40
;
run;
ods pdf file="example.pdf" notoc style=styles.test1;
proc report data=example nowd
style(header)=[bordertopwidth=0.5pt bordertopcolor=black]
;
column name num;
define name / order order=internal format=$4.;
break after name / page;
compute before _page_ / style=header{just=l};
line name $4.;
endcomp;
run;
ods pdf close;
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: