DATA Step, Macro, Functions and more

Data Step Delete Statement

Accepted Solution Solved
Reply
Frequent Contributor
Frequent Contributor
Posts: 83
Accepted Solution

Data Step Delete Statement

Happy Turkey Day all,

 

I have the following code;

 

date master;

set master;

if field1 = field2 then delete field2;

run;

 

This is giving me the following error:

 

ERROR Expecting a ;.

ERROR The option or parameter is not recognized and will be ignored. 

 

 

I've probably been looking at this too long, considering its turkey day and im working, but could use another set of eyes. 

 

Thanks in advance. Smiley Happy


Accepted Solutions
Solution
‎11-26-2015 05:40 PM
Super User
Posts: 17,951

Re: Data Step Delete Statement

Delete in SAS erases a row not a variable. You can't delete a variable, you can set it to missing though.

if field1=field2 then call missing(field2);

View solution in original post


All Replies
Solution
‎11-26-2015 05:40 PM
Super User
Posts: 17,951

Re: Data Step Delete Statement

Delete in SAS erases a row not a variable. You can't delete a variable, you can set it to missing though.

if field1=field2 then call missing(field2);
Frequent Contributor
Frequent Contributor
Posts: 83

Re: Data Step Delete Statement

Thanks for the quick reply.

 

Makes sense.

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 179 views
  • 1 like
  • 2 in conversation