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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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