Uloading
Uloading
This commit is contained in:
		
							
								
								
									
										35
									
								
								Chililabdata/code/newcode/genLongHouseholdInfo.do
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Chililabdata/code/newcode/genLongHouseholdInfo.do
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| clear all | ||||
| cd data | ||||
| use observation | ||||
| sort observeid | ||||
| save, replace | ||||
| use householdinfo | ||||
| sort observeid | ||||
| merge m:1 observeid using observation, keepusing(obs_entry_date) | ||||
| drop round | ||||
| keep if _merge ==3 | ||||
| drop if socialgpid =="" | ||||
| gen year = year( obs_entry_date/86400000) | ||||
| drop if year < 2004 | ||||
| gen h = halfyear(obs_entry_date/86400000) | ||||
| gen round = yh(year,h) | ||||
| sort socialgpid round | ||||
| gen period = round[_n+1]-round | ||||
| replace period = 109-round if socialgpid!=socialgpid[_n+1] | ||||
| expand period | ||||
| replace round = round-89 | ||||
| sort socialgpid round | ||||
| by socialgpid round: gen p= _n-1 | ||||
| replace round = round + p | ||||
| drop if round > 19 | ||||
| drop h period p _merge  obs_entry_date | ||||
| tostring round, generate(rounds) | ||||
| replace rounds = "0" + rounds if strlen(rounds) == 1 | ||||
| gen socialkey = socialgpid+  rounds | ||||
| drop hhinforid  | ||||
| sort socialkey | ||||
| duplicates drop socialkey, force | ||||
| save rHouseholdInfo, replace | ||||
|  | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user