deleting row with missing observation

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

deleting row with missing observation

Hi,

I have a large number of columns and rows.

I want to delete a row of data if one specific variable is missing (FIRMID) which is a character variable

I tried the following but it didn't seem to work

data want;

     set have;

     if FIRMID = " " then delete;

     run;

Any help appreciated


Accepted Solutions
Solution
‎11-17-2013 10:48 PM
Respected Advisor
Posts: 4,932

Re: deleting row with missing observation

Posted in reply to wschnell1

Your code should work, unless FIRMID contains non printable characters. Try this test instead

if notspace(FIRMID)=0 then delete;

PG

PG

View solution in original post


All Replies
Solution
‎11-17-2013 10:48 PM
Respected Advisor
Posts: 4,932

Re: deleting row with missing observation

Posted in reply to wschnell1

Your code should work, unless FIRMID contains non printable characters. Try this test instead

if notspace(FIRMID)=0 then delete;

PG

PG
SAS Super FREQ
Posts: 3,755

Re: deleting row with missing observation

Posted in reply to wschnell1

Did you try using the MISSING function?

if missing(firmid) then delete;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 216 views
  • 2 likes
  • 3 in conversation