I need only million format and if is negative ('-') then it should display ($6354466...)
if its 629777257.72 it should give $ 630 Million
if its 3063114.557 it should give $3M.
i have to store it in dataset and use the dataset for further calculations..
if it is between 0 and 1..it should give 1 Million
FYI: the values are being imported from EXCEL..
It'd be nice if you didn't change your requirements as you go.
This does what you asked. Modify to suit if your needs change again.
proc format;
picture million (ROUND)
low -< 0 = '000,000,000,000,009)' (prefix="($ ")
0 = 'Zero'
0 - 1e6 = '1 Million'
1e6 <-< 10e6 = '000,000,009 M' (prefix=" $ " mult=0.000001)
10e6 - high = '000,000,009 Million' (prefix=" $ " mult=0.000001)
;
run;
data _null_;
A = 1.2; putlog A= million. ;
A = -629777257.2; putlog A= million. ;
A = 629777257.2; putlog A= million. ;
A = 3063114.2; putlog A= million. ;
run;
A=1 Million
A=($ 629,777,257)
A=$ 630 Million
A=$ 3 M
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.