I am attempting to create a variable (post_int) which tells me whether there are months of unemploment after the interview month. I am not going into too much detail (such as why), because it would just make this question really long. But please ask, if it is indeed relevant.
This is an example where I am only interested in creating post_int for the year of 2004:
The columns with the numbers 1-12 represent whether someone was unemployed in the previous year. So in this case the person was unemployed until January 2003 and interviewed in March 2003. post_int should therefore stay zero in 2004.
However, the output puzzles me. It tells me s.th. about "temp0" and I cannot imagine where it got the zero from. Month of interview "pmonin" is going from 1 to 12 all missings are coded as "." or ".a".
I am using Stata 11.
This is an example where I am only interested in creating post_int for the year of 2004:
ID | Year | temp1 | temp2 | temp3 | temp4 | temp5 | temp6 | temp7 | temp8 | temp9 | temp10 | temp11 | temp12 | Month of interview "pmonin" |
34 | 2003 | . | . | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 3 |
34 | 2004 | 1 | . | . | . | . | . | . | . | . | . | . | . | 4 |
However, the output puzzles me. It tells me s.th. about "temp0" and I cannot imagine where it got the zero from. Month of interview "pmonin" is going from 1 to 12 all missings are coded as "." or ".a".
HTML Code:
. sort id year . g post_int = 0 . local n = !missing(L.pmonin) . . foreach i of varlist temp`n'-temp12{ 2. replace post_int=1 if `i'==1 3. } variable temp0 not found r(111);
Comment