BookmarkSubscribeRSS Feed
BigPete
Obsidian | Level 7

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;
2 REPLIES 2
BigPete
Obsidian | Level 7

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?

BigPete_0-1670185983822.png

 

BigPete_1-1670186017249.png

 

 

 


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;

 

 

 

BigPete
Obsidian | Level 7

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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 729 views
  • 0 likes
  • 1 in conversation