I am trying to fill in intermediate years when I have start and end years.
For example, consider the following dataset that includes firmid and the starting and ending years that the firm experienced a problem:
I would like the output to be a firm-year panel with a column that indicated if that particular firm-year had a problem or not (where problem start and end dates came from the above data sample). The difficulty I have is when there is more than 1 year between the start and end date. I am not sure how to fill those years in. The output would look like this (there is a firm-year panel for 6 years for each of the 3 unique firms and a problem variable in the output set is equal to 1 if there was a problem in that particular year and zero otherwise):
Thank you in advance.
For example, consider the following dataset that includes firmid and the starting and ending years that the firm experienced a problem:
Code:
clear* input firmid startyear endyear 11 2000 2002 11 2002 2003 12 2001 2003 12 2004 2004 13 2004 2005 13 2005 2005 end
Code:
clear* input firmid year problem 11 2000 1 11 2001 1 11 2002 1 11 2003 1 11 2004 0 11 2005 0 12 2000 0 12 2001 1 12 2002 1 12 2003 1 12 2004 1 12 2005 0 13 2000 0 13 2001 0 13 2002 0 13 2003 0 13 2004 1 13 2005 1 end
Comment