BookmarkSubscribeRSS Feed
radha1
Calcite | Level 5

Hi,

 

Can anyone help me converting from 125,804 to 125804.

2.53.476
253476

 

Thanks in advance

2 REPLIES 2
Tom
Super User Tom
Super User

How is that a FORMAT issue?

Where are the existing values? Where do you want the converted values?

Do they have commas or periods in them? Or both?

 

If you have character variables why not just use COMPRESS()?

data have ;
  input str $20. ;
cards;
125,804 
2.53.476
253476
;

data want ;
 set have ;
 new = compress(str,',.');
run;
Obs      str        new

 1     125,804     125804
 2     2.53.476    253476
 3     253476      253476
ballardw
Super User

At least provide the current format the variable has and the variable name.

You can get that information from Proc Contents or table properties.

 

The example values you show indicate that the variable must be character as none of the SAS supplied formats would treat both comma and period as the thousands separator your example implies. So do you want an actual numeric value or a character value without the comma and period?

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 639 views
  • 0 likes
  • 3 in conversation