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');
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');
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');
yes, it works... Thanks for the advice.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.