I hope it is clear what I want to do without code:
I have a date set, and if one condition is true then I want to delete that row. If it is not true, then I don't want to do anything with the data, just let it be what it is.
How could I achieve this?
Thanks.
Just like you wrote it:
if /* condition */ then delete;
Just like you wrote it:
if /* condition */ then delete;
Here's a simple example, just to illustrate:
data have;
input name $ age;
datalines;
Allen 12
Bob 23
Charles 34
Doug 45
Edward 56
;
run;
title 'Before:';
proc print data=have; run;
data want;
set have;
if name = 'Bob' then delete;
run;
title 'After:';
proc print data=want; run;
To use with a subsetting IF just invert the test.
if name = 'Bob' then delete;
is the same as
if not (name = 'Bob') ;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.