Hi,
How do I display negative currency values in SAS list report in paranthesis ? Also, preferably with a red text.
I could do it easily in excel by creating a custom format but can't find my way around it in SAS EG.
Thanks in anticipation,
Varun
Try nlmny10. or rstdodn10. format, this should work.
try the
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000205173.htm
NEGPARENw.d Format
Hi, Thanks.
I already tried that. It is for numeric values only. My values need to be displayed with a preceding $ sign.
Try nlmny10. or rstdodn10. format, this should work.
@SuryaKiran wrote:
Try nlmny10. or rstdodn10. format, this should work.
may need to add some decimals if you want them to the format.
Text color is going to be ODS style dependent though color overrides are available in report procedures such as Proc Print, Report and tabulate.
Example formatting a text color based on the numeric value:
proc format library=work; value agecolor 11='red' 12='pink' 13='blue' 14='orange' other='black' ; run; proc print data=sashelp.class; var age /style=[foreground=agecolor.]; run;
Numeric formats can have a $ sign. I suspect here you may need to roll your own. I think for the colour aspect, it will need some sort of styling elsewhere, but the negative value with parenthesis is probably a picture format.
@VarunD wrote:
Hi, Thanks.
I already tried that. It is for numeric values only. My values need to be displayed with a preceding $ sign.
@VarunD wrote:
Hi, Thanks.
I already tried that. It is for numeric values only. My values need to be displayed with a preceding $ sign.
Below code a combination of what others wrote already. You will still have to tweak it a bit but it should point you into the right direction.
data have;
do value=-150 to 150 by 50;
output;
end;
stop;
run;
proc format library=work;
value currcol
low-<0 ='red'
0 ='green'
other ='black'
;
picture myp(default=10)
low-0='00009)'(prefix='( $')
other='00009'(prefix='$')
;
run;
proc print data=have;
format value myp.;
var value /style=[foreground=currcol.];
run;
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.