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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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