How to use parental information in analysis

The database contains variables for measuring fathers and mothers personal id-number which can be utilised in order to merge parental information into an individual level dataset.

The commando merge can be used to merge datasets. The identification key variabel given by the source dataset is used by default. This can be overruled by using an on-option.

In the example below, separate datasets are made for fathers and mothers. These are merged into the main individual level dataset via the key variables fnr_far and fnr_mor respectively.

//Create a main dataset with links to fathers and mothers
create-dataset persondata
import INNTEKT_WYRKINNT 2010-01-01 as inntekt
import BEFOLKNING_KJOENN as kjønn
import NUDB_BU 2010-01-01 as utd
import BEFOLKNING_FAR_FNR as fnr_far
import BEFOLKNING_MOR_FNR as fnr_mor

//Import data on fathers and merge into main dataset
create-dataset fardata
import INNTEKT_WYRKINNT 2010-01-01 as inntekt_far
import NUDB_BU 2010-01-01 as utd_far
merge inntekt_far utd_far into persondata on fnr_far

//Import data on mothers and merge into main dataset
create-dataset mordata
import INNTEKT_WYRKINNT 2010-01-01 as inntekt_mor
import NUDB_BU 2010-01-01 as utd_mor
merge inntekt_mor utd_mor into persondata on fnr_mor

//Perform basic linear regression analysis to test for covariation with parental income
use persondata
generate mann = 0
replace mann = 1 if kjønn == '1'

destring utd, force
generate høyutd = 0
replace høyutd = 1 if utd >= 700000 & utd < 999999
replace høyutd = utd if sysmiss(utd)

destring utd_far, force
generate høyutd_far = 0
replace høyutd_far = 1 if utd_far >= 700000 & utd_far < 999999
replace høyutd_far = utd_far if sysmiss(utd_far)

destring utd_mor, force 
generate høyutd_mor = 0
replace høyutd_mor = 1 if utd_mor >= 700000 & utd_mor < 999999
replace høyutd_mor = utd_mor if sysmiss(utd_mor)

summarize inntekt inntekt_far inntekt_mor
histogram inntekt_far, percent
histogram inntekt_mor, percent
correlate inntekt_far inntekt_mor
tabulate høyutd_far høyutd_mor

regress inntekt mann inntekt_far inntekt_mor høyutd høyutd_far høyutd_mor