Information about ongoing education (so-called course data) is available with courses as unit level (with associated course identifier). Courses are given by the combination of person x course type, where each individual can in practice be represented by several course types at the same time.
Since course data does not have a person as a unit, these cannot be imported into personal datasets in the usual way, but must be connected using the
First, you have to add a link between the course ID and the person ID on the course data. You then have to aggregate up to person level using the command
collapse before finally connecting to the personal dataset.
In the example, a personal dataset is first created consisting of people residing in Norway (
regstatus == '1') as of 2021-01-01. A history of ongoing education is then retrieved for the entire year 2021, where you select for education at a higher level (master’s or higher, level 7 and 8). The command
collapse(count) is used to count the number of observations with ongoing education per individual over the year 2021, and the result is then linked to the person dataset for further analysis.
NB! Note that the kurstype (course type) variable after using
collapse will consist of values for the relevant statistic being run, in this case the number of observations (
//Kobler til databank
require no.ssb.fdb:23 as db
//Oppretter persondatasett for bosatte per 2020-01-01
import db/BEFOLKNING_KJOENN as kjønn
import db/BEFOLKNING_STATUSKODE 2020-01-01 as regstatus
keep if regstatus == '1'
//Henter personer som tar høyere utdanning i løpet av 2020
import-event db/NUDB_KURS_NUS 2020-01-01 to 2020-12-31 as kurstype
keep if kurstype >= 700000 & kurstype < 900000
//Kobler på lenke mellom kurs-id og fødselsnumre
import db/NUDB_KURS_FNR as fnr
merge fnr into kursdata
//Lager statistikk (collapser) over antall hendelser med høy utdanning per individ, og kobler dette på persondatasettet
collapse (count) kurstype, by(fnr)
rename kurstype ant_kurs
merge ant_kurs into bosatte
//Lager tabell over antall personer som tok høy utdanning i løpet av 2020
generate utdanning_høy = 0
replace utdanning_høy = 1 if ant_kurs >= 1
tabulate utdanning_høy kjønn