Hi, for the life of me I can't find any help on this. Obviously, I don't know what search terms to use. I want to create the variables x3 and x4, as below. The data set is a panel (state year), but xtset has not been set as yet due to the information in repeated time values. I will eventually drop the first instance of year==1975. Thanks for your suggestions.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long state float(year x1 x2 x3 x4)
1 1968 . . 0 0
1 1969 2 . 1 1
1 1970 . . 1 1
1 1971 . . 0 0
1 1972 . . 0 0
1 1973 . . 0 0
1 1974 . . 0 0
1 1975 2 . 0 0
1 1975 . 4 1 1
1 1976 . . 1 1
1 1977 . . 0 1
1 1978 . . 0 1
1 1979 . . 0 0
1 1980 . . 0 0
1 1981 . . 0 0
1 1982 . . 0 0
1 1983 . . 0 0
1 1984 . . 0 0
1 1985 . . 0 0
1 1986 . . 0 0
end
label values state state
label def state 1 "Alabama", modify