I have a panel of states. In my data set, I have a dummy variable (treat) such that:
treat = 1, if state i and j adopted the policy at timet
= 0 Othewise
treat is a post-treatment dummy which equal 1 when the policy was first adopted by two states and thereafter; and 0 for all the years before the adoption.
However, for some dyadic state-pairs, the treat dummy is not stable, i.e., the two states are treated (treat=1) in one-period, untreated in other period (treat=0) and then again treated (treat=1) in some other period. I need to check for the state-pairs where such multiple (more than 1) switches in the treatment occur. I am posting the data example below, in the example the treat switches between 0 and 1 multiple time in the sample period within each dyadic pair. How can I identify such state-pairs where the treat switches between 0 and 1 more than once. Checking by scrolling would be a tedious exercise in this large panel data of mine.
Any help would be highly appreciated ! Nick Cox Carlo Lazzaro
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str2(state_i state_j) int year byte treat "AB" "JK" 1970 0 "AB" "JK" 1971 0 "AB" "JK" 1972 0 "AB" "JK" 1973 0 "AB" "JK" 1974 1 "AB" "JK" 1975 1 "AB" "JK" 1976 1 "AB" "JK" 1977 1 "AB" "JK" 1978 1 "AB" "JK" 1979 0 "AB" "JK" 1980 0 "AB" "JK" 1981 0 "AB" "JK" 1982 0 "AB" "JK" 1983 0 "AB" "JK" 1984 0 "AB" "JK" 1985 0 "AB" "JK" 1986 1 "AB" "JK" 1987 1 "AB" "JK" 1988 1 "AB" "JK" 1989 1 "AB" "JK" 1990 1 "AB" "TM" 1975 1 "AB" "TM" 1976 1 "AB" "TM" 1977 1 "AB" "TM" 1978 0 "AB" "TM" 1979 0 "AB" "TM" 1980 0 "AB" "TM" 1981 1 "AB" "TM" 1982 1 "AB" "TM" 1983 0 "AB" "TM" 1984 0 "AB" "TM" 1985 0 "AB" "TM" 1986 1 "AB" "TM" 1987 1 "AB" "TM" 1988 1 end
0 Response to How to identify when a treatment switches between 0 and 1 multiple time in the sample period
Post a Comment