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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.