The SAS Output Delivery System and reporting techniques

Print negative number in RED - E-mail

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Print negative number in RED - E-mail

[ Edited ]

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


Accepted Solutions
Solution
‎02-01-2016 07:19 AM
Respected Advisor
Posts: 3,799

Re: Print negative number in RED - E-mail

compute percent;
   if sign(percent) eq -1 then call define(_col_,'style','style=[color=RED]');
   endcomp;

View solution in original post


All Replies
Super User
Posts: 7,832

Re: Print negative number in RED - E-mail

I don't see how you implemented the red color logic in the first place. Could you also supply that piece of the code?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎02-01-2016 07:19 AM
Respected Advisor
Posts: 3,799

Re: Print negative number in RED - E-mail

compute percent;
   if sign(percent) eq -1 then call define(_col_,'style','style=[color=RED]');
   endcomp;
New Contributor
Posts: 2

Re: Print negative number in RED - E-mail

Posted in reply to data_null__
Thanks a lot.

It worked perfectly.

I was not aware of SIGN() function..
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 487 views
  • 0 likes
  • 3 in conversation