SC3 - Schulform über die Zeit

Liebe NEPSler,

diesmal geht es um eine Variable, die je Welle anzeigt, auf welcher Schule man sich befindet. Die bereitgestellte, konstruierte Schulvariable T723080_G1 soll laut dem Technical Report (NEPS working paper no. 46) nicht für Panelanalysen verwendet werden („…it cannot be applied to individually tracked students“).

Nun habe ich versucht über die individuellen Trackings (CAWI, CATI Interviews) eine Variable zu konstruieren, die genau das bewirkt. Ich mir jedoch unsicher, ob man das so machen kann. 

Ich bin sehr dankbar über Hinweise, Tipps und Verbesserungsvorschläge!

** dataset generated by merging Cohortprofile and Target data

*************************************************
*	Panel Information
*************************************************
*maximum wave
egen maxw = max(wave)
*sort in descending order and fill gaps across waves
g negwave = -wave

*panel frame
g panel_frame = tx80230 if tx80230 > 0
	la val panel_frame de2569 
	
*sampling edutype
g sampling_edu = tx80106 
	drop if sampling_edu == 7 //drop special needs school 
	


*************************************************
*	School information
*************************************************
*NEPS' constructed variable
g school_neps = t723080_g1 if t723080_g1 > 0

*info from individual tracking
g tracked_edutype = -1 if tx80232 == 1 , tx80232 == 2 //elem. school or orientation
	replace tracked_edutype = 1 if tx80232 == 4 //HS
	replace tracked_edutype = 2 if tx80232 == 5 , tx80232 == 6 //RS
	replace tracked_edutype = 3 if tx80232 == 3 //GS
	replace tracked_edutype = 4 if tx80232 == 7 //GY
		
	
*------ Edutype self-constructed ------*	
*first sampling edutype
	g edutype = -1 if sampling_edu == 1 & wave == 1 //Orientation/Elementary
	replace edutype = 1 if sampling_edu == 2 & wave == 1 //HS
	replace edutype = 2 if (sampling_edu == 3 , sampling_edu == 4) & wave == 1 //RS
	replace edutype = 3 if sampling_edu == 5 & wave == 1 //GS
	replace edutype = 4 if sampling_edu == 6 & wave == 1 //GY
	
*NEPS constructed variable
	bys id (wave): replace edutype = 1 if t723080_g1 == 3 , t723080_g1 == 6 , t723080_g1 == 12 //HS
	bys id (wave): replace edutype = -1 if t723080_g1 == 1 , t723080_g1 == 2 //Elem or orientation 
	bys id (wave): replace edutype = 2 if t723080_g1 == 4 , t723080_g1 == 7 , t723080_g1 == 13 //RS
	bys id (wave): replace edutype = 3 if t723080_g1 == 5 , t723080_g1 == 8 , t723080_g1 == 11 , t723080_g1 == 15 //GS and other
	bys id (wave): replace edutype = 4 if t723080_g1 == 9 , t723080_g1 == 14 //GY

*panel_frame (3: vocational)
	replace edutype = -2 if panel_frame == 3 & edutype == . //VOC
	
*individual tracking
	bys id: replace edutype = tracked_edutype if tracked_edutype != . //indiv. tracking info
		
*Imputation of missing observations in between
	*same school at start and end
	bys id: replace edutype = edutype[1] if edutype[1] == edutype[6] 
	*different school at start and end, but switch in between: Assume same school until switch occurs
	bys id: replace edutype = edutype[_n-1] if edutype[_n-1] != . & edutype == . ///
			& edutype[_n+4] != . & edutype[_n+1] == . & edutype[_n+2] == .	& edutype[_n+3] == .	
	bys id: replace edutype = edutype[_n-1] if edutype[_n-1] != . & edutype == . ///
				& edutype[_n+3] != . & edutype[_n+1] == . & edutype[_n+2] == .	
	bys id: replace edutype = edutype[_n-1] if edutype[_n-1] != . & edutype == . ///
				& edutype[_n+2] != . & edutype[_n+1] == .
	bys id: replace edutype = edutype[_n-1] if edutype[_n-1] != . & edutype == . ///
				& edutype[_n+1] != .