Can someone help me out with some code that would delete observations where date="31Oct2022"d AND prev_date="31Mar2022"d (i.e. observation only deleted if BOTH conditions are true)?
Desired outcome: Delete observations only where date="31Oct2022"d AND prev_date="31Mar2022"d i.e. if only one condition met, keep observations e.g. date="29Apr2022"d / prev_date="31Mar2022"d because only one condition is met
When I run the code below, it deletes observations where date="31Oct2022"d or prev_date="31Mar2022"d for some reason (e.g. in my example above, it deleted the three observations where date="29Apr2022"d / prev_date="31Mar2022"d) - can someone suggest how I can edit my code to get my desired outcome please?
data test;
set ac.information_values;
where (date ne "31Oct2022"d and prev_date ne "31Mar2022"d);
run;
Obvi a problem where the words of explanation don't match the code.
If your run the code shown and then "When I run the code below, it deletes observations where date="31Oct2022"d or prev_date="31Mar2022"d for some reason", I consider this impossible, either that's not the code, or your words are wrong.
Perhaps you could clear that up.
Anyway, what I *think* you want is this:
data test;
set ac.information_values;
if date="31Oct2022"d and prev_date="31Mar2022"d then delete;
run;
Obvi a problem where the words of explanation don't match the code.
If your run the code shown and then "When I run the code below, it deletes observations where date="31Oct2022"d or prev_date="31Mar2022"d for some reason", I consider this impossible, either that's not the code, or your words are wrong.
Perhaps you could clear that up.
Anyway, what I *think* you want is this:
data test;
set ac.information_values;
if date="31Oct2022"d and prev_date="31Mar2022"d then delete;
run;
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!
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.