Solved
Contributor
Posts: 30

# Dates Between Start and End Date

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

Accepted Solutions
Solution
‎01-11-2018 01:20 AM
Super User
Posts: 9,829

## Re: Dates Between Start and End Date

Do loops:

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

All Replies
Solution
‎01-11-2018 01:20 AM
Super User
Posts: 9,829

## Re: Dates Between Start and End Date

Do loops:

```data want;
startdate="01jan2018"d;
enddate="10jan2018"d;
do date=startdate to enddate;
output;
end;
run;```
Super User
Posts: 13,923

## Re: Dates Between Start and End Date

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;```
☑ This topic is solved.