BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Praveen1
Calcite | Level 5

Hi ,

 

I am trying to print the negative numbers in RED text and send the contents to my email id

 

I am able to print numbers in the body of the email using proc report but loosing the red color logic.

 

Can someone please share the style or format i need to apply to get the negative numbers in red color on the email body

 

I have a bunch of percentages/dollar values to keep it simple for the users i have created a simple version of code.

 

data test;
input @1 percent;
datalines;
10.12
-10.30
20.3
-40.30
;
run;
title "";
FILENAME NOTE EMAIL
TO=("user@gmail.com")
SUBJECT ="DAILY"
type="text/html"

;
ods html body=note;

PROC REPORT DATA=TEST;
COL percent;
DEFINE percent / display ;
RUN;

QUIT;

ODS HTML CLOSE;

 

Thanks

Praveen

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19
compute percent;
   if sign(percent) eq -1 then call define(_col_,'style','style=[color=RED]');
   endcomp;

View solution in original post

3 REPLIES 3
data_null__
Jade | Level 19
compute percent;
   if sign(percent) eq -1 then call define(_col_,'style','style=[color=RED]');
   endcomp;
Praveen1
Calcite | Level 5
Thanks a lot.

It worked perfectly.

I was not aware of SIGN() function..

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
  • 3 replies
  • 2420 views
  • 0 likes
  • 3 in conversation