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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 695 views
  • 0 likes
  • 2 in conversation