Dear all,
I'm working with a dataset that holds over 197 million records (administrative household data) including all household transitions in the Netherlands 1999-2014. All variables are in string-format and since the great amount of records and complexity of values; you can find a 'simplified' impression of my data down below.
In order to conduct a time-series analysis, I would like to create a partner_id variable such as the one as you can see below. It must 'copy' the personal identifier 'id' of the partner in that particular year based on the household identifier hhid but only in case of a marriage. My household identifier hhid, however, also records children living in that particular household. So I want to tell Stata to only copy the partner's id and to exclude any possible children in this matter.
Could anyone help me out with this? Thanks in advance and best regards.
Roy Peijen
I'm working with a dataset that holds over 197 million records (administrative household data) including all household transitions in the Netherlands 1999-2014. All variables are in string-format and since the great amount of records and complexity of values; you can find a 'simplified' impression of my data down below.
In order to conduct a time-series analysis, I would like to create a partner_id variable such as the one as you can see below. It must 'copy' the personal identifier 'id' of the partner in that particular year based on the household identifier hhid but only in case of a marriage. My household identifier hhid, however, also records children living in that particular household. So I want to tell Stata to only copy the partner's id and to exclude any possible children in this matter.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float year str6(id hhid) str7 status str4 partner_id 1999 "L31A" "H0TH" "MARRIED" "H4N" 2000 "L31A" "H0TH" "MARRIED" "H4N" 2001 "L31A" "Y4V1N" "MARRIED" "C3P0" 1999 "H4N" "H0TH" "MARRIED" "L31A" 2000 "H4N" "H0TH" "MARRIED" "L31A" 2001 "H4N" "F4LC0N" "MARRIED" "R2D2" 1999 "R2D2" "SH1P" "SINGLE" "" 2000 "R2D2" "SH1P" "SINGLE" "" 2001 "R2D2" "F4LC0N" "MARRIED" "H4N" 1999 "C3P0" "" "SINGLE" "" 2000 "C3P0" "" "SINGLE" "" 2001 "C3P0" "L31A" "MARRIED" "L31A" 2001 "R3Y" "H0TH" "CHILD" "" 2001 "CH3WI3" "Y4V1N" "CHILD" "" 2001 "B3N" "H0TH" "CHILD" "" end
Could anyone help me out with this? Thanks in advance and best regards.
Roy Peijen
Comment