Hello,
I have a requirement to display negative currency in paranthesis. So I am using a custom format. Here is how the format is
created
proc format lib=sasrepo;
picture DollarParen low - -1 = '000,000,000,000.00)' (prefix='($')
-1 <-< 0 = '99)' (prefix='($0.' mult=100)
0 -< 1 = '99' (prefix='$0.' mult=100)
1 - high = '000,000,000,000.00' (prefix='$');
run;
My field has the number -142663408.917
when I use the Dollar format, the field displays as -142663408.92 which is correct.
but when I use the custom format I get
($142663408.91). For some reason the custom format is stripping the last digit. Even if I round the number
round(-142663408.917,.01) and then apply the custom format I still get the field to display ($142663408.91)
Can you please look at the custom format and let me know what I need to do to get the right dispaly. I need the negative currency
amounts to display in paranthesis and rounded to 2 digit.
Thank You
Shri
I believe you need the ROUND option...
picture DollarParen(round)
Thanks,
I changed the format to be
proc format lib=sasrepo;
picture DollarParen round((low - -1 = '000,000,000,000.00)' (prefix='($')
-1 <-< 0 = '99)' (prefix='($0.' mult=100)
0 -< 1 = '99' (prefix='$0.' mult=100)
1 - high = '000,000,000,000.00' (prefix='$')),.01);
run;
But I am getting the error
Syntax error, expecting one of the following: a quoted string, a numeric constant,
a datetime constant, a missing value, ;, (, LOW, OTHER.
Can you please tell me where the round should be??
Just like in my example
picture picture_name(picture_options) and the rest.
Do you have access to the SAS help facility?
_null_ is right.try this:
proc format ; picture DollarParen(default=20 round) low - -1 = '000,000,000,000.00)' (prefix='($') -1 <-< 0 = '99)' (prefix='($0.' mult=100) 0 -< 1 = '99' (prefix='$0.' mult=100) 1 - high = '000,000,000,000.00' (prefix='$'); run;
Ksharp
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.
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.