- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try nlmny10. or rstdodn10. format, this should work.
Suryakiran
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
try the
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000205173.htm
NEGPARENw.d Format
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Thanks.
I already tried that. It is for numeric values only. My values need to be displayed with a preceding $ sign.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try nlmny10. or rstdodn10. format, this should work.
Suryakiran
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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;