BookmarkSubscribeRSS Feed
Ethen
Calcite | Level 5

Hi everyone!

 

I have the following code and it works fine, except that I like to be able to format the value in the Csal, Cuni and Csalt variables, such as making the font color or back ground color of the values in the Csal, Cuni and Csalt variables different than the texts preceding them.

 

I appreciate any help you could provide!

 

compute after / style=Header{just=l fontweight=bold fontsize=14pt};
region = 'All Regions';
Csal = left(put(salesmn,dollar10.));
Cuni = left(put(unit_pricemn,dollar10.));
Csalt = left(put(sales_taxmn,dollar10.));
line "^{style[textdecoration=underline]Averages for These Regions}";
line "Sales: " Csal $varying50.;
line "Unit Price: " Cuni $varying50.;
line "Sales Tax: " Csalt $varying50.;
endcomp;
run;

 

Ethen,

 
4 REPLIES 4
SuryaKiran
Meteorite | Level 14

You call define with foreground= or background=

Check this out:

proc format;
value $stat 'Normal'='green'
'Underweight'='orange'
'Overweight'='red';
run;
proc report data=sashelp.heart;
column bp_status weight_status ageatstart;
define bp_status /group ;
define weight_status /group;
define ageatstart/mean format=8.2;
compute weight_status;
call define(_col_,'style','style={foreground=$stat.}');
endcomp;
run; 
Thanks,
Suryakiran
Cynthia_sas
SAS Super FREQ

Hi:

  If you want to change the font color of text in a LINE statement, you have limited choices. Either you change the color of the WHOLE string or you use ODS ESCAPECHAR, as shown below:

use_escapechar_line.png

 

  If you want to use the normal RBREAK statement and a CALL DEFINE, then you can change foreground color and background color, to produce this:

use_rbreak.png

using this code:

use_rbreak_code.png

 

Hope this helps,

Cynthia

Ethen
Calcite | Level 5

Hi Cynthia!

 

Thank you!  I appreciate your time very much!

 

Your codes worked exactly the way I needed for it to work.

 

Thanks, again!

 

Ethen,

 

Ethen
Calcite | Level 5

HI Suryakiran!

 

Thank you!  I appreciate your time very much!

 

Your codes worked, but they applied the styles to the values in the column and not the line statement.

 

Thanks!

 

Mark,

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
  • 4 replies
  • 773 views
  • 1 like
  • 3 in conversation