Basically, since some of the variables are so long they end up looking like scientific notation in excel, so I have to use the
var X /style(data)={tagattr='format:@'};
SO I want to print all the variables, but want to apply some styling options to just a few. How do I do that without writing var statements for all variables?
The only way to apply style to specific variables is to use multiple VAR statements. If you have multiple vars that you want to style the same, you can list them on the same VAR statement. So, for example, see the code below. You can set some overall defaults on the PROC PRINT statement, but individual variables with differing styles will need to be on separate VAR statements.
cynthia
ods tagsets.excelxp file='c:\temp\stylechange.xml' style=htmlblue;
proc print data=sashelp.shoes (obs=10)
style(obsno)={background=pink color=navy}
style(header)={background=pink}
style(column)={font_face='Courier New'};
var region / style(header)={background=darkblue color=yellow font_weight=bold}
style(data)={background=darkblue color=yellow font_weight=bold};
var subsidiary / style(header)={font_size=12pt font_weight=bold};
var product / style(data)={background=lightyellow};
var sales inventory returns / style(data)={background=grayaa font_size=12pt font_weight=bold};
run;
ods tagsets.excelxp 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 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.