Hi,
How to un-select (delete) records in data step?
I have 100 records type in input and I want to skip any data with name started with ABC or DEF or GHI.
Thanks David
HAVE is the input sample I created for demonstration
You could also use boring substr function to achieve the same
data want; set have; where substr(var,1,3) not in ('ABC','DEF','GHI'); run;
if substr(var,1,3) not in ('ABC','DEF','GHI');
View solution in original post
data have; input var $10.; cards; ABCrwe DEFte GHIgteg dfserg bfgdxbh vxfgnb vsdrgf ; data want; set have; if var not in :('ABC','DEF','GHI'); run;
You could use WHERE as well
where var not in :('ABC','DEF','GHI');
yes, it works... Thanks for the advice.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.