I have a sample data like this:
Here invoice_dt is in format DDMMYYS10.;
Sale invoice_dt
A 23/07/2018
B 01/07/2018
C 22/07/2018
D 04/03/2019
E 31/03/2019
R 31/07/2018
F 01/05/2018
I 10/07/2015
J 01/02/2014
I want to write a where condition in datastep to delete records where invoice_dt is in between 01/07/2018 to 31/07/2018 and 01/03/2019 to 31/03/2019,
Please help.
Just look at the position of the marker in the log.
DELETE is a data step statement, not an option used in other statements.
Since you want to filter out observations, negate the conditions
where not ("firstdate"d le date le "lastdate"d) and not ("otherfirstdate"d le date le "otherlastdate"d);
If you have further trouble, post the complete log of the step into a window opened with this button:
Date literals are specified in SAS in the form "ddmonyyyy"d, like
"23nov2021"d
So you can use a condition like
"01jul2018"d le invoice_dt le "31jul2018"d
and combine multiple such conditions with OR
Just look at the position of the marker in the log.
DELETE is a data step statement, not an option used in other statements.
Since you want to filter out observations, negate the conditions
where not ("firstdate"d le date le "lastdate"d) and not ("otherfirstdate"d le date le "otherlastdate"d);
If you have further trouble, post the complete log of the step into a window opened with this button:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.