BookmarkSubscribeRSS Feed
Gloveman71
Calcite | Level 5

I currently use SAS 9.4 in a Grid.

 

Please refer the the listed link,  my question pertains to this:  http://support.sas.com/kb/23/353.html

 

Please see the Proc Print example,  Can you define multiple format styles for use in Proc Print on different variables?  I would like to use the background style format on different variables based on the value of the variable.  I have also listed the example below for easier explanation:

 

   ods html body='temp.html';

   proc format;
     value temp 11=red
                12=purple
                13=orange
                14=pink
                16=yellow
                other=blue;
   run;

   ods html body='temp.html';

   proc print data=sashelp.class ;
     var age / style={background=temp.};
     var sex height weight;
   run;

   ods html close;

 

 

Hope I have explained this properly,

Thanx for any help,

Jim Glover

2 REPLIES 2
Tim_SAS
Barite | Level 11

Is this what you want?

 

ods html file="test.html";

proc format;
   value agef
      11-13='red'
      13<-high='cyan';
	value $sexf
		M='yellow'
		F='pink';
      

proc print data=sashelp.class;
   var name;
   var age / style={background=agef.};
   var sex / style={background=$sexf.};
   var height / style={background=black color=white};
   var weight / style={background=black color=yellow};
   run;
ods html close;
Gloveman71
Calcite | Level 5

Yes, Thanx for the assist. I setup some additional formats and they worked great!!!

 

Thanx again,

Jim Glover

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1091 views
  • 0 likes
  • 2 in conversation