If beginning year and ending year are known, how to fill in years in between?

Question:

Suppose two companies A and B are connected in some years. Say, right now the data structure is the following:

Company 1 Company 2 Starting Year Ending Year
A B 2000 2006
A C 1998 2003
C D 1995 1997

I want to find a way to generate:

Company 1 Company 2 Year
A B 2000
A B 2001
…………….
A B 2006
A C 1998
……………..
A C 2003
C D 1995
……………..
C D 1997

Answer:

 

This entry was posted in SAS. Bookmark the permalink.

3 Responses to If beginning year and ending year are known, how to fill in years in between?

  1. Eka says:

    Hi Kai,

    Thanks for the great codes you provide in your website. I am trying to use this code but, unfortunately, I received this error:
    “ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or
    the BY expression is missing, zero, or invalid.”

    Would you be able to assist?

  2. James says:

    Hi Kai,
    Thanks for posting your code on the website, I benefit a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *