Hi All,
I want to find out dates between start date and End Date.
suppose
StartDate EndDate
01Jan2018 10Jan2018
Then output should be
Date
01Jan2018
02Jan2018
03Jan2018
04Jan2018
05Jan2018
06Jan2018
07Jan2018
08Jan2018
09Jan2018
10Jan2018
Do loops:
data want; startdate="01jan2018"d; enddate="10jan2018"d; do date=startdate to enddate; output; end; run;
Do loops:
data want; startdate="01jan2018"d; enddate="10jan2018"d; do date=startdate to enddate; output; end; run;
@ashishj816 wrote:
Hi All,
I want to find out dates between start date and End Date.
suppose
StartDate EndDate
01Jan2018 10Jan2018
Then output should be
Date
01Jan2018
02Jan2018
03Jan2018
04Jan2018
05Jan2018
06Jan2018
07Jan2018
08Jan2018
09Jan2018
10Jan2018
If by "find" you mean that you have an existing data set and want to extract to a new set one way:
data want; set have; if '01JAN2018'd le datevar le '10JAN2018'd; run;
If you mean do something for specific records:
data want; set have; if '01JAN2018'd le datevar le '10JAN2018'd do; /* statements*/ end; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.