BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

data have;

num = 3298056;

pct = 46.51644;

avg = 1.2555

run;

 

What is the best way to format the numbers to capture proper commas and to capture the numbers up to 2 decimal places only

 

So num = 3,298,056   pct = 46.52  avg = 1.25

1 REPLY 1
PaigeMiller
Diamond | Level 26

You can use different formats for each variable. So for NUM, use the COMMA format, and for PCT and AVG, you can use best10.2 (or similar, there are many choices that will work)

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 766 views
  • 0 likes
  • 2 in conversation