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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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