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

Hi SAS Experts,

 

Is there is anyway to get the million format on dollar values. Below is the data and code.

 

data test;
informat amnt dollar14.;
format amnt dollar14.;
input amnt person$;
datalines;
196200000 b
1000000 c
2500000 d
1600000 e
;
run;


needed output:

 

amnt person
196.2M B
1M C
2.5M D
1.6M E

 

Note: Amnt should be numeric value only.

 

Thanks & regards,

Sanjay

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

use low - -1 instead of -1 - -45000000, for example

 

low - -1 = '0,000,009.9M' (mult=0.00001 prefix='-')
--
Paige Miller

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

I created my own picture format for this purpose, you probably want to modify the code below for your exact needs

 

proc format;
	picture million low-high='0,000,009.9MM' (prefix='$' mult=.00001);
run;
--
Paige Miller
sanjay1
Obsidian | Level 7

Hi PaigeMiller,

 

Thank you for your help, but how can i get the minus values like (-1000000  should be like -1.0).

 

 

PaigeMiller
Diamond | Level 26

Instead of using the same picture for all values low to high, you specify a picture with a minus sign for negative values, and a different picture for positive values, with no minus sign.

--
Paige Miller
sanjay1
Obsidian | Level 7

Ya I tried something like this, but the negative values are resuled in millions(like 1000000) and positive values are resulted in (like 1.0).


proc format;
picture million -1 - -45000000='0,000,009.9M' (mult= -.00001)
1 - high='0,000,009.9M' (mult=.00001);
run;

PaigeMiller
Diamond | Level 26

use low - -1 instead of -1 - -45000000, for example

 

low - -1 = '0,000,009.9M' (mult=0.00001 prefix='-')
--
Paige Miller
sanjay1
Obsidian | Level 7

Thank you, it worked well for me.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 868 views
  • 0 likes
  • 2 in conversation