BookmarkSubscribeRSS Feed
user112a2
Obsidian | Level 7

Hello. I have a question on format in SAS. Below is my code

 Removed

correction_am is format numeric 8. How do I change this to Comma10.2 or Dollar10.2 in SAS in data step or proc sql code? I have tried various methods that did not work.

I have tried below code which worked but did not retain the two decimal places.

Removed

 

3 REPLIES 3
user112a2
Obsidian | Level 7

Hey I tried that and it did not format with commas:

 

Removed

I want: 

Removed

 

Tom
Super User Tom
Super User

@user112a2 wrote:

Hey I tried that and it did not format with commas:

 

2084608.44

I want: 

2,084,608.44 or $2,084,608.44


You need count the commas (and dollar sign) when setting the width.

1234567890123456
2084608.44
$2,084,608.44

Try DOLLAR13.2 or increase the width even more if your values can be larger than $9,999,999,99

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 3374 views
  • 1 like
  • 3 in conversation