Originally posted by Carlo Lazzaro
View Post
you helped me to gen this variable, but it doesn't count what i want.
the variable ehc28p1 says if the person is living in the same flat like he/she did the year before. So 0= No which means YES MOVE and 1=Yes which means NO MOVE. I generated the variable like i showed before.
Code:
bysort id (wave): g move=0 if ehc28p1[_n]==ehc28p1[_n-1] & ehc28p1!=. bysort id: replace move=1 if ehc28p1[_n]!=ehc28p1[_n-1] & ehc28p1!=. label variable move "Umzug in einer Andere Wohnung" label define move 0 "kein Umzug" 1 "Umzug" /// 0 "no Move" 1 "Move" label values move move
Code:
bysort id (wave): g umzug=1 if ehc28p1[_n]==ehc28p1[_n-1] & ehc28p1!=. bysort id: replace umzug=0 if ehc28p1[_n]!=ehc28p1[_n-1] & ehc28p1!=.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long id byte(wave ehc28p1) float move 111000 3 0 1 111000 4 1 1 111000 5 1 0 111000 6 1 0 111000 7 1 0 111000 8 1 0 1300000 3 1 1 1300000 4 1 0 3902000 5 1 1 3902000 6 1 0 3902000 7 1 0 3902000 8 1 0 4835000 5 1 1 4858000 5 1 1 4858000 6 1 0 6151000 5 1 1 6151000 6 1 0 6151000 7 1 0 6151000 8 1 0 6519000 4 1 1 6519000 5 1 0 6519000 6 1 0 6519000 7 1 0 6519000 8 1 0 8948000 3 1 1 8948000 4 1 0 8948000 5 1 0 8948000 6 1 0 8948000 7 1 0 8948000 8 1 0 9657000 5 1 1 9657000 8 1 0 9917000 5 1 1 9917000 6 1 0 9917000 8 1 0 10208000 3 1 1 10208000 4 1 0 10208000 5 1 0 10208000 6 1 0 10208000 7 1 0 10208000 8 1 0 10957000 3 1 1 10957000 4 1 0 10957000 5 1 0 11295000 4 0 1 11295000 5 1 1 11295000 6 1 0 11295000 7 1 0 11295000 8 1 0 12266000 3 1 1 12266000 6 1 0 12471000 6 1 1 12490000 3 1 1 12490000 4 1 0 12490000 5 1 0 12490000 6 1 0 12490000 7 1 0 12490000 8 1 0 13345000 3 1 1 13588000 6 1 1 13588000 7 1 0 13937000 6 1 1 13937000 8 1 0 14722000 3 1 1 14722000 4 1 0 14722000 5 1 0 14722000 6 1 0 14722000 7 1 0 14722000 8 1 0 14898000 4 1 1 14898000 6 1 0 14902000 5 1 1 14902000 6 1 0 14902000 8 1 0 15595000 4 1 1 15595000 5 1 0 15595000 6 1 0 15595000 7 1 0 15595000 8 1 0 16512000 4 1 1 16512000 5 1 0 16512000 6 1 0 16512000 7 1 0 16512000 8 1 0 16671000 3 1 1 16671000 4 1 0 16829000 3 1 1 16829000 4 1 0 16829000 5 1 0 17018000 3 1 1 17018000 4 1 0 17018000 5 1 0 17018000 6 0 1 17018000 7 0 0 17018000 8 1 1 17464000 3 1 1 17464000 4 1 0 17464000 5 1 0 17464000 6 1 0 18011000 3 1 1 end label values wave WAVE_prt3 label def WAVE_prt3 3 "3 2010/11", modify label values ehc28p1 liste160a_ac3 label def liste160a_ac3 0 "0 Nein", modify label def liste160a_ac3 1 "1 Ja", modify label values move move label def move 0 "kein Umzug", modify label def move 1 "Umzug", modify
Comment