I want to create a panel data based on a cross section data set and fill in observations per quarter. A variable called Present needs to be created. Present = 1 for the interval between (and included) Startdate and (included) Enddate, 0 otherwise. The observation period starts 1 Jan 1994 and ends 31 Dec 1996. The missing value in dataline 3 indicate that the state is still ongoing (truncation). DATA HAVE; INPUT Id Startdate DDMMYYYY8. Enddate DDMMYYYY8.; DATALINES; 1 15021994 06111994 2 15021995 31121995 2 01051996 . ; DATA WANT; ID yearqarter PRESENT 1 1994Q1 1 1 1994Q2 1 1 1994Q3 1 1 1994Q4 0 1 1995Q1 0 1 1995Q2 0 1 1995Q3 0 1 1995Q4 0 1 1996Q1 0 1 1996Q2 0 1 1996Q3 0 1 1996Q4 0 2 1994Q1 0 2 1994Q2 0 2 1994Q3 0 2 1994Q4 0 2 1995Q1 1 2 1995Q2 1 2 1995Q3 1 2 1995Q4 1 2 1996Q1 0 2 1996Q2 1 2 1996Q3 1 2 1996Q4 1
... View more