Direkt zum Inhalt

Do-files for working with SOEP spell data

Do-files for working with SOEP spell data

SPELL_TO_PANEL, PANEL_TO_SPELL, SPELL_TO_SPELL, EVENT_TO_SPELL, and SPITTING_OVERLAPS

Spell, duration or event history data are used frequently in the social sciences. Handling this kind of data can be cumbersome, especially when you want to supplement spell data with panel data or vice versa. Alternatively, you might want to combine two spell files or enrich spell data with information on events while keeping the spell structure of your data. To accomplish these tasks, we provide five do-files to facilitate the data management.

      • PANEL_TO_SPELL: This do-file helps to supplement information contained in a spell dataset with panel information. For instance, one can enrich employment spells with annually surveyed information on the branch of industry the respondents are working in while maintaining the spell structure.

(for an example see Table 1, Panel C)

      • SPELL_TO_PANEL: Alternatively, you might want to do the opposite and enrich a panel dataset with information from spell data. An example for such a procedure is extracting incidences or the duration of part-time employment between two annually conducted interviews. The resulting file will be in a panel structure.

(for an exampleTable 1, Panel D)

      • SPELL_TO_SPELL: This do file combines two spell files. For example you want to supplement employment histories stored in one spell dataset with marital histories contained in another one. The spell structure will be maintained in the resulting dataset.

(for an example seeTable 2, Panel C)

      • EVENT_TO_SPELL: You may want to introduce events to spell data while keeping a spell structure. This occurs for instance when you are interested in adding the event of a giving birth for the first time to a spell dataset of marital histories.

(for an example seeTable 3, Panel C)

      • SPITTING_OVERLAPS: Some spell data might contain overlapping spells meaning that one spell starts before a previous spell ends (i.e. while a person still works part-time he or she starts with vocational training). For example two overlapping spells of vocational training and part-time employment are split according to the time of their intersection such that the time of the overlap is depicted by two subspells which have the same beginning and ending.

(for an example seeTable 4, Panel B)

When handling spell data it is furthermore necessary to take potential censoring into account. Censoring denotes that the beginning or ending of a spell is imprecise because of missing information or the beginning or ending of a spell is outside of the period of observation. However, in contrast to other written do files or ado files, all provided do-files guarantee correct censoring throughout the procedures. For instance, vocational training in the Table 4 (Panel A:) is “Left And Right Censored”. After splitting this spell one ends with first subspell that is left censored and the second subspell that is right censored.

The full documentation on how to use the do –files you will find here (PDF, 386.41 KB)

The do-files you will find here (ZIP, 296.8 KB)


Table 1: Example of merging panel and spell data

A: Original spell data

begin

end

status

spell nr

censor

[135] 1994 Mar

[138] 1994 Jun

[4] Vocational Training

8

[1] Uncensored

[146] 1995 Feb

[149] 1995 May

[4] Vocational Training

9

[1] Uncensored

[146] 1995 Feb

[149] 1995 May

[3] Part-Time Employment

10

[4] Left Censored

B: Original panel data

month of interview

year of interview

marital status

branch of industry

[3] March

1994

[1] married

[-2] Does not apply

[4] April

1995

[2] single

[80] Education

C: Collapsed spell data by enriching information from panel data

begin

end

status

spell nr

marital status

branch of industry

censor

[135] 1994 Mar

[138] 1994 Jun

[4] Vocational Training

8

[1] Married

[-2] Does not apply

[1] Uncensored

[146] 1995 Feb

[147] 1995 Mar

[4] Vocational Training

9

 

[80] Education

[1] Uncensored

[146] 1995 Feb

[147] 1995 Mar

[3] Part-Time Employment

10

 

[80] Education

[4] Left Censored

[148] 1995 Apr

[149] 1995 May

[4] Vocational Training

9

[3] Single

[80] Education

[1] Uncensored

[148] 1995 Apr

[149] 1995 May

[3] Part-Time Employment

10

[3] Single

[80] Education

[1] Uncensored

D: Generated panel data by enriching information from panel data

month of interview

year of interview

marital status

branch of industry

incidence_of_
the_state_3

incidence_of_
the_state_4

duration_of_
the_state_3

duration_of_
the_state_4

[3] March

1994

[1] Married

[-2] Does not apply

 

 

 

 

[4] April

1995

[3] Single

[80] Education

1

1

2

6

nach oben


Table 2: Example of combining two spell datasets

A: Original spell data (master file)

begin

end

status1

spell number

censor

[36] 1985 Dec

[39] 1986 Mar

[3] Part-Time Employment

4

[4] left censored

[36] 1985 Dec

[39] 1986 Mar

[4] Vocational Training

2

[4] left censored

[40] 1986 Apr

[43] 1986 Jul

[1] Full-Time Employment

5

[5] right and left

B: Original spell data (using file)

begin

end

status

spell number

censor

[36] 1985 Dez

[40] 1986 Apr

[1] Single

1

[2] left censored

[41] 1986 Mai

[44] 1986 Aug

[2] Married

2

[1] left censored

C: Collapsed Spell data

begin

end

status of master file

spell nr of master

censor of master

status of
using file

spell nr of using

censor of using

[36] 1985 Dec

[40] 1986 Apr

[3] Part-Time

4

[4] left censored

[1] Single

1

[2] left censored

[36] 1985 Dec

[40] 1986 Apr

[4] Vocational Training

2

[4] left censored

[1] Single

1

[0] uncensored

[40] 1986 Apr

[41] 1986 May

[1] Full-Time

5

[4] left censored

[1] Single

1

[0] uncensored

[41] 1986 May

[44] 1986 Aug

[1] Full-Time

5

[2] right censored

[2] Married

2

[1] left censored

[44] 1986 Aug

[45] 1986 Sep

.

 

 

[2] Married

2

[0] uncensored

nach oben


Table 3: Example of combining spell dataset with information on events

A: Original spell data

begin

end

status

spell number

censor

[36] 1985 Dec

[40] 1986 Apr

[1] Single

1

[0] Uncensored

[41] 1986 May

[44] 1986 Aug

[2] Married

2

[5] Right censored

B: Event Data

month of the birth

year of birth

gender of first child

[2] February

1986

[1] Male

C: Spell data in compressed version

begin

end

status

spell number

censor

event

nr. of event

gender of first child

[36] 1985 Dec

[37] 1986 Jan

[1] Single

1

[0] Uncensored

0

0

.

[38] 1986 Feb

[40] 1986 Apr

[1] Single

1

[0] Uncensored

1

1

[1] Male

[41] 1986 May

[44] 1986 Aug

[2] Married

2

[5] RZ: Last Spell

0

1

.

nach oben


Table 4: Example of overlapping spells

A: Original spell data

begin

end

status

spell number

censor

[146] 1995 Feb

[149] 1995 May

[3] Part-Time Employment

10

[2] Right Censored

[147] 1995 Mar

[152] 1995 Aug

[4] Vocational Training

9

[5] Left And Right Censored

B: Split spell data with parallel subspells

begin

end

status

spell number

censor

[146] 1995 Feb

[146] 1995 Feb

[3] Part-Time Employment

10

[1] Uncensored

[147] 1995 Mar

[149] 1995 May

[4] Vocational Training

9

[4] Left Censored

[147] 1995 Mar

[149] 1995 May

[3] Part-Time Employment

10

[2] Right Censored

[150] 1995 Jun

[152] 1995 Aug

[4] Vocational Training

9

[2] Right Censored

nach oben


keyboard_arrow_up