Hello,
I am trying to add style elements to the by line of my PDF file output. As of now it is putting the variable, an '=' sign, and the output. I want to control the style (font, label name, etc.) as well as the output (remove the '='). I have tried several ways and read the SAS documentation on ODS Style and Proc Print, but I'm unable to come across a solution. Is this possible or should I try another route to achieve this?
I've messed around with using a title statement as a placeholder of var2, but the by line separates the output by the second variable (var2), and nest a table under that unique variable so it gets messy trying to make that work.
Sample Code:
ods pdf close;options orientation=landscape nodate number nocenter papersize=legal; ods pdf file="&path&name .pdf" style=my_style; title1 justify=left font=arial 'Left Title' justify=right "Right Title"; Proc print data=have rows=page split='*' style(header obs obsheader)={just=center font_face=arial fontsize=2.2} obs="Item"; by var1 var2; /*this is what I want to control the style of*/ Var var3 var4/style(data)=[background=white just=center font_face=arial fontsize=2]; format var3 var4 best7.2; label var3= 'The Third Variable' var4= 'The Fourth Variable'; run; ods pdf close; run;
This is exactly what I needed, thank you very much.
FYI - I've moved this post to the ODS Reporting section so hopefully you get a better response here.
Follow as Reeza said.
data have(index=(x=(sex age)));
set sashelp.class;
if age in ( 12 14 15);
run;
options nobyline;
ods pdf file="c:\temp\temp.pdf" style=meadow;
title1 justify=left font=arial 'Left Title' justify=right "Right Title";
title2 j=left color=red bcolor=green "#byvar1 = #byval1 || #byvar2 = #byval2";
Proc print data=have rows=page split='*' style(header obs obsheader)={just=center font_face=arial fontsize=2.2} obs="Item";
by sex age; /*this is what I want to control the style of*/
Var weight height/style(data)=[background=white just=center font_face=arial fontsize=2];
run;
ods pdf close;
I followed what Reeza said and that is the solution. Great to see it here in practice as the visual showed me what to apply. Thank you for your help.
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.