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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.