BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have some data that I cannot clean appropriately. I have read in some data that contains single quotes in variables that I want as numeric. I have tried to create a new variable by multiplyingh the old variable by 1 and also using the input function of creating a new variable, but the new variable always has a missing value.

Below is the error I get.

NOTE: Invalid numeric data, '44,178.67' , at line 640 column 9
3 REPLIES 3
deleted_user
Not applicable
Just use this:

B=INPUT(COMPRESS(A,'0123456789.','k'),8.);

where A is your dirty data and B will be your clean numerical one.

Ike Eisenhauer Message was edited by: WDEisenhauer
deleted_user
Not applicable
This worked great. Thank you.

~ Max
Bulgani
Calcite | Level 5
This is a superb solution to a problem I have. I wanted to keep any numeric values in a field but eliminate the characters. This was perfect for that situation.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 755 views
  • 0 likes
  • 2 in conversation