Help using Base SAS procedures

Trying to print everything from a dataset but format/style a few of the variables

Reply
Frequent Contributor
Posts: 82

Trying to print everything from a dataset but format/style a few of the variables

   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?

SAS Super FREQ
Posts: 8,864

Re: Trying to print everything from a dataset but format/style a few of the 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;

Ask a Question
Discussion stats
  • 1 reply
  • 218 views
  • 0 likes
  • 2 in conversation