Apologize for such a basic question but I cannot figure it out. When I use the format below for numbers in the millions, it comes out as $n.n M, but a number in billions only comes out as $ n B, I would like to add the decimal place so that $1.5 billion would read as $1.5 B, not $1 B. Thanks!
proc format;
picture money (fuzz=0)
-1000000000000000-<-1E12='0000 T' (prefix='-$' mult=1E-012)
-1000000000000-<-1E09='0000 B' (prefix='-$' mult=1E-09)
-1000000000-<1E06='0000 M' (prefix='-$' mult=.000001)
1E06-<1000000000='0000 M' (prefix='$' mult=.000001)
1E09-<1000000000000='0000 B' (prefix='$' mult=1E-09)
1E12-<1000000000000000='0000 T' (prefix='$' mult=1E-012);
run;
Like this?
proc format;
picture money (fuzz=0)
-1E15 -< -1E12='0000 T' (prefix='-$' mult=1E-12)
-1E12 -< -1E09='0000 B' (prefix='-$' mult=1E-09)
-1E09 -< 1E06='0000 M' (prefix='-$' mult=1E-06)
1E06 -< 1E09='0000 M' (prefix= '$' mult=1E-06)
1E09 -< 1E10='00.9 B' (prefix= '$' mult=1E-08)
1E10 -< 1E12='0000 B' (prefix= '$' mult=1E-09)
1E12 -< 1E15='0000 T' (prefix= '$' mult=1E-12);
run;
data t;
A=3.3e07; put A A money.;
A=3.3e08; put A A money.;
A=3.3e09; put A A money.;
A=3.3e10; put A A money.;
run;
33000000 $33 M
330000000 $330 M
3300000000 $3.3 B
33000000000 $33 B
Like this?
proc format;
picture money (fuzz=0)
-1E15 -< -1E12='0000 T' (prefix='-$' mult=1E-12)
-1E12 -< -1E09='0000 B' (prefix='-$' mult=1E-09)
-1E09 -< 1E06='0000 M' (prefix='-$' mult=1E-06)
1E06 -< 1E09='0000 M' (prefix= '$' mult=1E-06)
1E09 -< 1E10='00.9 B' (prefix= '$' mult=1E-08)
1E10 -< 1E12='0000 B' (prefix= '$' mult=1E-09)
1E12 -< 1E15='0000 T' (prefix= '$' mult=1E-12);
run;
data t;
A=3.3e07; put A A money.;
A=3.3e08; put A A money.;
A=3.3e09; put A A money.;
A=3.3e10; put A A money.;
run;
33000000 $33 M
330000000 $330 M
3300000000 $3.3 B
33000000000 $33 B
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.