I am looking for help in creating a dummy variable for a time series. This is a sample of the data I have so far.
Game_ID | score | intro | intro_year | intro_month |
1 | 67 | 1995m1 | 1995 | 1 |
2 | . | 1996m2 | 1996 | 2 |
3 | 26 | 1998m8 | 1998 | 8 |
... | ... | ... | ... | ... |
Game_ID | score | intro | intro_year | intro_month | available_1995m1 | available_1996m2 | available_1998m8 |
1 | 67 | 1995m1 | 1995 | 1 | 1 | 1 | 1 |
2 | . | 1996m2 | 1996 | 2 | 0 | 1 | 1 |
3 | 26 | 1998m8 | 1998 | 8 | 0 | 0 | 1 |
... | ... | ... | ... | ... | ... | ... | ... |
egen time_id =group(intro_year intro_month)
order time_id
forvalues i = 1(1)183 {
gen av`i'= 1 if time_id <=`i'
replace av`i'= 0 if time_id >`i'
}
Thanks for taking the time.
0 Response to Creating a time series dummy variable
Post a Comment