BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
csetzkorn
Lapis Lazuli | Level 10

This works fine:

 

proc format; 
 value Bla 
    low -< -1.0 = "red" 
    -1 -< 0 = "green"
	0 - high = "white"; 
run;

proc print data=Temp NOOBS; 
	var X Y Z
	/style(data) = [background=Bla.];	 
run;

I am in a situation where my vars are dynamic so I cannot use the /style option. Is there a way to apply the above format to all numeric values in the table to be printed?

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You can always use var, even if its a matter of doing:

proc sql;
  select name into :vlist separated by " " 
  from sashelp.vcolumn 
  where libname="WORK" and memname="TEMP";
quit;

proc print data=temp;
  var &vlist.;
run;

"Can't" is not in programming.

As for the issue, the key is to use the _numeric_ SAS command, which means all numeric variables:

proc print data=temp;
  var _numeric_ / style(data)=[background=bla.];
run;

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Something like:

proc print data=temp noobs;
  var x y z;
  format _numeric_ bla.;
run;
csetzkorn
Lapis Lazuli | Level 10
Thanks. Firstly I cannot use var. Secondly (tried this) but it does not change the background color but prints the format values.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You can always use var, even if its a matter of doing:

proc sql;
  select name into :vlist separated by " " 
  from sashelp.vcolumn 
  where libname="WORK" and memname="TEMP";
quit;

proc print data=temp;
  var &vlist.;
run;

"Can't" is not in programming.

As for the issue, the key is to use the _numeric_ SAS command, which means all numeric variables:

proc print data=temp;
  var _numeric_ / style(data)=[background=bla.];
run;
csetzkorn
Lapis Lazuli | Level 10
wow this is exactly what I needed (-:

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 4 replies
  • 983 views
  • 2 likes
  • 2 in conversation