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:
Calling all data scientists and open-source enthusiasts! Want to solve real problems that impact your company or the world? Register to hack by August 31st!
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.