In order to perform statistical analysis on a dataset, there is often a need to trim the dataset by removing unwanted units. This can be done by using the
keep commands in combination with standard IF-conditions.
In the example below, the data population is trimmed into persons between 16 and 66 years of age.
//Connect to datastore require no.ssb.fdb:13 as db create-dataset demography import db/BEFOLKNING_KJOENN as gender import db/BEFOLKNING_FOEDSELS_AAR_MND as birthdate generate age = 2020 - int(birthdate / 100) keep if age >= 16 & age < 67