BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cho8
Calcite | Level 5

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..

 

 

 

 

ChrisNZ
Tourmaline | Level 20

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 16 replies
  • 6200 views
  • 5 likes
  • 5 in conversation