DATA Step, Macro, Functions and more

Missing value for char variable-how to delete

Reply
Frequent Contributor
Posts: 102

Missing value for char variable-how to delete

Dear all,

I have a character variable SIC with some missing values. I used the script (see below) to eliminate those observations and the sas log says "Character values have been converted to numeric values at the places given by...:"

IF SIC=" " THEN DELETE;

My question: do I need to convert SIC into numeric before using  IF SIC=" " THEN DELETE;

thanks,

Lan

Respected Advisor
Posts: 4,919

Re: Missing value for char variable-how to delete

If SIC really is a character variable then the note refers to another statement. - PG

PG
Trusted Advisor
Posts: 1,137

Re: Missing value for char variable-how to delete

i agree with PG,

The chances of note mentioned will arise when the sic variable data is character and you are considering it as numeric data while deleting. something like below

if sic=. then delete. However as per your post, it is a character and you have used the right statement.

Check if there are any other variable which is character and you are trying to delete those records considering the data is numeric.

Thanks,

Jagadish

Thanks,
Jag
Super User
Posts: 11,338

Re: Missing value for char variable-how to delete

Posted in reply to Jagadishkatam

The log should have reported line numbers and number of times. Look at the code with that line number in the log.

I'll bet you've done a numeric function such as adding, subtracting or mulitplying with a variable you thought was numeric but is actually character.

Contributor
Posts: 71

Re: Missing value for char variable-how to delete

Could it also be that SAS is trying to convert the non-blank values in SIC?

Frequent Contributor
Posts: 102

Re: Missing value for char variable-how to delete

Thanks to everyone who replied to my post !!!

SIC was numeric. my mistake. I changed the code  IF SIC=. THEN DELETE; it works.

-Lan

Ask a Question
Discussion stats
  • 5 replies
  • 305 views
  • 1 like
  • 5 in conversation