BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ashishj816
Quartz | Level 8

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Do loops:

data want;
  startdate="01jan2018"d;
  enddate="10jan2018"d;
  do date=startdate to enddate;
    output;
  end;
run;

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Do loops:

data want;
  startdate="01jan2018"d;
  enddate="10jan2018"d;
  do date=startdate to enddate;
    output;
  end;
run;
ballardw
Super User

@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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3900 views
  • 3 likes
  • 3 in conversation