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;
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.