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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.