- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would probably recommend using a custom title statement instead and using #BYVAL/#BYVAR options instead.
Note the usage of multiple TITLE statements in this example:
https://support.sas.com/resources/papers/proceedings/proceedings/sugi23/Coders/p75.pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would probably recommend using a custom title statement instead and using #BYVAL/#BYVAR options instead.
Note the usage of multiple TITLE statements in this example:
https://support.sas.com/resources/papers/proceedings/proceedings/sugi23/Coders/p75.pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This is exactly what I needed, thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
FYI - I've moved this post to the ODS Reporting section so hopefully you get a better response here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.