How to populate table with all possible dates between the first (minimum) and last (maximum) date.

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

How to populate table with all possible dates between the first (minimum) and last (maximum) date.

Hello everyone.

 

I created a table with a first (minimum) and last (maximum) date from another dataset.

 

This is how the above metioned table looks.

Capture.JPG

 

I want to create another table starting from the first (Minimum) date and creating all possible dates up until the last (Maximum) date.

 

Do anyone maybe have a suggestion to do this?

 

Thank you.


Accepted Solutions
Solution
‎05-14-2017 04:04 PM
Grand Advisor
Posts: 17,459

Re: How to populate table with all possible dates between the first (minimum) and last (maximum) dat

Use a DO loop with the start and end variables as the dates and an explicit OUTPUT statement.

 

data want;

    set have;

   do date=start_date to end_date;
       
       OUTPUT;

   end;

run;

View solution in original post


All Replies
Solution
‎05-14-2017 04:04 PM
Grand Advisor
Posts: 17,459

Re: How to populate table with all possible dates between the first (minimum) and last (maximum) dat

Use a DO loop with the start and end variables as the dates and an explicit OUTPUT statement.

 

data want;

    set have;

   do date=start_date to end_date;
       
       OUTPUT;

   end;

run;

Occasional Contributor
Posts: 7

Re: How to populate table with all possible dates between the first (minimum) and last (maximum) dat

Thank you for the help Reeza.Smiley Happy

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 122 views
  • 0 likes
  • 2 in conversation