Durchgängige Berufstätigkeit über mehrere Wellen

Hallo zusammen,

ich möchte für die SC 6 nur Personen berücksichtigen, die durchgängig über eine bestimmte Anzahl an Wellen berufstätig waren (ob Teilzeit oder Vollzeit spielt dabei keine Rolle). Wie gehe ich das am besten an? Nutze ich dafür den Subspell oder die Variable tx29080?

Vielen Dank!

Hallo Laura!
Benno ist leider nicht da und deswegen springe ich ein:

Um dein Ziel zu erreichen, musst du Episodendaten und mit der richtigen wave-Variable aus CohortProfile zusammenbringen.
Die wave-Variable in Episodendaten sagt nur aus, wann Episoden erhoben wurden, nicht wann sie stattfanden. Um zu erfahren, in welcher Welle Episoden stattfanden, muss man die Start- und Enddaten der Episoden mit dem Interviewdatum aus CohortProfile mergen. Das kann man durch Episoden- oder Monatssplitting erreichen. Für jede Episode wird pro Monat eine Zeile angelegt (variable month erzeugen). Wenn man dann auch im CohortProfile eine gleichnamige Variable erzeugt, die auf dem Interviewdatum beruht, kann man die Welleninformation mit den Infos aus spEmp matchen. Wenn sie matchen, liegt ein Spell, also Arbeit vor, wenn sie nur im CohortProfile sind, nicht.

Ich habe ein Minimalbeispiel für dein Problem angefügt. Weitere Beisiele findest du auch hier im Forum.

tx29080 und den gesamten Basics-Datensatz sollte man nur verwenden um sich einen Überblick zu verschaffen, aber für Analysen ist das Datensatz ungeeignet.

Ich hoffe, das hilft dir weiter.

LG
Dietmar


// define variables you want to use
global usevars ID_t splink subspell disagint ts23223_g1

// open variables you want to use in spEmp
use ${usevars} using "${path}/SC6_spEmp_D_15-0-0.dta", clear
keep if subspell == 0 & disagint != 2 // drop unharmonized and revoked subspells

// match Biography to gain smoothed dates
merge 1:1 ID_t splink using "${path}/SC6_Biography_D_15-0-0.dta", keep(matched) nogenerate keepusing(start* end* splast)

// generate variable for starts and ends of episodes
generate start = ym(starty,startm)
generate end = ym(endy,endm)

// drop episodes with missing information
keep if !missing(start,end)

// generate duration to prepare for expand
generate duration =  end - start + 1

// expand/multiply dataset by the month of duration  
expand duration

// generate variable for each month of an episode
bysort ID_t splink : generate nr = _n
generate month = start + nr -1

// check if generation of month-variable has been successful
assert month >= start & month <= end
bysort ID_t splink (nr): assert month - month[_n-1] == 1 if ((ID_t == ID_t[_n-1]) & (splink == splink[_n-1]))
 
 // format date variables
format %tm start end month
keep ID_t splink ts23223_g1 splast start end duration month // keep only information you need
tempfile monsplitt_spEmp
save "`monsplitt_spEmp'", replace

****************************************************

// open CohortProfile and gernerate a month-variable as well to match month-based spells of spEmp
use ID_t wave tx80521 tx8601m tx8601y using "${path}/SC6_CohortProfile_D_15-0-0.dta", clear
keep if tx80521 == 1 
generate month = ym(tx8601y,tx8601m)
keep ID_t wave month 
isid ID_t month
// keep also data which is only in CohortProfile - those are the wave without employment-episodes
merge 1:m ID_t month using "`monsplitt_spEmp'", keep(master matched)
drop month
label drop `: val lab wave'

// if you are only interested if a person has any employment episode in a wave, you can do this:
generate work = (_merge == 3)
drop _merge
label define work_lb 0"no" 1"yes"
label values work work_lb
duplicates drop ID_t wave, force // drop all additional information of spells (if a person has multiple employment episode per wave)