Hi! I would like to delete some lines from my data. See the print screen for an overview.
I want to remove the lines from the cows who have a chain_number starting with an "N". How can I ask this to SAS?
Thanks!
So I'm pretty sure my original code works. Did you leave out the colon between = and 'N' ? It's easy to overlook.
if you see an "N" no matter where you see it then delete?
if find(chain_number,'N')>0 then delete;
if left(chain_number)=:'N' then delete;
Do I need to sort by chain_number first?
Thanks,
Hi, when I used the code it changed nothing so I have tried
data f6r;
set f6;
if first(chain_number)='N' then delete;
run;
first instead of left, and it worked!
But as I explore my data, I see that sometimes the N is after a space or at the end of the number. Can we ask: if you see an "N" no matter where you see it then delete?
Thanks
So I'm pretty sure my original code works. Did you leave out the colon between = and 'N' ? It's easy to overlook.
if you see an "N" no matter where you see it then delete?
if find(chain_number,'N')>0 then delete;
Thanks, with this line everything is ok!
where first(strip(chain_number)) ne 'N';
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.