Collect information on ongoing education

Data on ongoing education (studies) exist with course as unit level (through unique course-identificator numbers). Courses are defined by the combination person x course type, and each individual can be represented by more than one course types simultaneously.

As data on ongoing education do not have person as unit level, such data can not be imported directly into an individual level dataset, but instead need to be merged through the commando merge.

First, one must add/import a variable containing a link between course-ids and corresponding person-ids onto the course data (ongoing education). Next, one must aggregate the data to individual level through the commando collapse. Finally, the data need to be merged into the main individual level dataset.

In the example below, an individual level dataset containing persons resident in Norway (regstatus == ‘1’) per 2010-01-01 is used as main dataset. Then ongoing education study streams over the period 2010-2012 is collected, where only higher level education (master or higher, education level 7 og 8) is kept. The commando collapse (count) is used to count the number of observations/streams for ongoing education per individual over the period 2010-2012, and the result is finally merged into the main individual level dataset for further analysis.

Note: The values of the variable coursetype will after the collapse-transformation be replaced by numerical values refering to the statistical measure being used, in this case count (number of observations/streams).

//Connect to databank
require no.ssb.fdb:1 as fdb1

//Create individual level dataset containing residents in Norway per 2010-01-01 including the variable sex
create-dataset persondata
import fdb1/BEFOLKNING_KJOENN as sex
import fdb1/BEFOLKNING_REGSTAT 2010-01-01 as regstatus
keep if regstatus == '1'

//Collect persons studying on higher education level in the period 2010-2012
create-dataset coursedata
import-event fdb1/NUDB_KURS_NUS 2010-01-01 to 2012-01-01 as coursetype
destring coursetype, force
keep if coursetype >= 700000 & coursetype < 999999

//Merge link between course-id and personal-id into course data
create-dataset link_course_person
import fdb1/NUDB_KURS_FNR as idnr
merge idnr into coursedata

//Count number of observations/streams concerning higher educational studies per individual, and merge into main individual level dataset
use coursedata
collapse (count) coursetype, by(idnr)
rename coursetype courses
merge courses into persondata

// Produce tabulation for higher level education studies (individual frequencies over 2010-2012 period)
use persondata
generate edu_high = 0
replace edu_high = 1 if courses >= 1
tabulate edu_high sex