How to use parental information in analysis

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

The merge command can be used to merge datasets. The main identification key variabel of the target dataset is used by default. This can be overruled by using an on-option.

In the example below, a separate parent dataset is made. The parental data are merged into the main individual level dataset via the key variables idnr_father and idnr_mother respectively.

//Connect to datastore
require no.ssb.fdb:13 as db

//Create a main dataset with links to fathers and mothers
create-dataset persondata
import db/INNTEKT_WYRKINNT 2019-01-01 as workincome
import db/BEFOLKNING_KJOENN as gender
import db/NUDB_BU 2019-01-01 as edu
import db/BEFOLKNING_FAR_FNR as idnr_father
import db/BEFOLKNING_MOR_FNR as idnr_mother

//Import data on parents and merge into main dataset
create-dataset parents
import db/INNTEKT_WYRKINNT 2019-01-01 as workincome_father
import db/NUDB_BU 2019-01-01 as edu_father
clone-variables workincome_father -> workincome_mother
clone-variables edu_father -> edu_mother
merge workincome_father edu_father into persondata on idnr_father
merge workincome_mother edu_mother into persondata on idnr_mother

//Perform basic linear regression analysis to test for covariation with parental income
use persondata
generate male = 0
replace male = 1 if gender == '1'

destring edu
generate high_edu = 0
replace high_edu = 1 if edu >= 700000 & edu < 900000
replace high_edu = edu if sysmiss(edu)

destring edu_father
generate high_edu_father = 0
replace high_edu_father = 1 if edu_father >= 700000 & edu_father < 900000
replace high_edu_father = edu_father if sysmiss(edu_father)

destring edu_mother
generate high_edu_mother = 0
replace high_edu_mother = 1 if edu_mother >= 700000 & edu_mother < 900000
replace high_edu_mother = edu_mother if sysmiss(edu_mother)

summarize workincome workincome_father workincome_mother
histogram workincome_father, percent
histogram workincome_mother, percent
correlate workincome_father workincome_mother
tabulate high_edu_father high_edu_mother

regress workincome male workincome_father workincome_mother high_edu high_edu_father high_edu_mother