{"id":61,"date":"2022-02-11T13:55:58","date_gmt":"2022-02-11T12:55:58","guid":{"rendered":"https:\/\/microdata.spirehost.no\/?post_type=eksempel&#038;p=61"},"modified":"2023-10-27T16:39:19","modified_gmt":"2023-10-27T15:39:19","slug":"how-to-define-and-create-populations","status":"publish","type":"eksempel","link":"https:\/\/www.microdata.no\/en\/eksempel\/how-to-define-and-create-populations\/","title":{"rendered":"How to define and create populations"},"content":{"rendered":"\n<p>The analysis system microdata.no is based on the left-join principle. This means that the first variable that is created determines the size of the population. If this is a universal variable such as gender, your dataset will consist of as many individuals as possible from the total database, including people who have died, emigrated or were not born at the time you want to analyse.<\/p>\n\n\n\n<p>Do you start by importing a variable that only applies to a limited number of individuals, e.g. disability benefits, your dataset will only consist of people in Norway who received disability benefits at the relevant time you are measuring.<\/p>\n\n\n\n<p>You cannot make the population larger than variable no. 1 allows for (unless you use the option <code>outer_join<\/code>). So you have to think about which variable you start importing, so that you get all the people you want to analyse with you. However, you can make populations smaller if you wish. This is done using the\u00a0<code>drop if<\/code>\u00a0or\u00a0<code>keep if<\/code> command.<\/p>\n\n\n<div id=\"rose-block_0e0b8664dcade7a12e8b07fc998084e3\" class=\"rose-code codeblock-wrapper\">\n<pre tabindex=\"0\" class=\"codeblock\"><code>\/\/Connect to datastore\r\nrequire no.ssb.fdb:23 as db\r\n\r\n\/\/Example 1: Population = all residents of Bergen as of 1\/1 2021\r\ncreate-dataset eks1\r\nimport db\/BEFOLKNING_KOMMNR_FAKTISK 2021-01-01 as residence\r\nkeep if residence == '4601'\r\n\r\n\/\/Example 2: Population = all residents of Vestland as of 1\/1 2021\r\ncreate-dataset eks2\r\nimport db\/BEFOLKNING_KOMMNR_FAKTISK 2021-01-01 as residence\r\nkeep if substr(residence, 1, 2) == '46'\r\n\r\n\/\/Example 3: Population = everyone with an occupational income in the year 2021 (= everyone with an annual occupational income > 0 in 2021)\r\ncreate-dataset eks3\r\nimport db\/INNTEKT_WYRKINNT 2021-12-31 as work_income\r\n\r\n\/\/Example 4: When you start with a universal variable but actually want to analyse individuals with given characteristics at a given time\r\ncreate-dataset eks4\r\nimport db\/BEFOLKNING_KJOENN as gender\r\nimport db\/INNTEKT_WYRKINNT 2021-12-31 as work_income\r\ndrop if sysmiss(work_income)\r\n\r\n\/\/Example 5: When you start with a universal variable but actually want to analyse individuals who were actually resident in Norway at a given time. The variable BEFOLKNING_STATUSKODE is suitable for this purpose as it contains codes for respectively \"resident\", \"dead\" and \"emigrated\". \"Resident\" has the code '1'.\r\ncreate-dataset eks5\r\nimport db\/BEFOLKNING_KJOENN as gender\r\nimport db\/BEFOLKNING_STATUSKODE 2021-01-01 as regstatus\r\nkeep if regstatus == '1'<\/code><\/pre>\n<\/div>","protected":false},"parent":0,"menu_order":6,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":""},"class_list":["post-61","eksempel","type-eksempel","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to define and create populations - microdata.no<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to define and create populations - microdata.no\" \/>\n<meta property=\"og:description\" content=\"The analysis system microdata.no is based on the left-join principle. This means that the first variable that is created determines the size of the population. If this is a universal variable such as gender, your dataset will consist of as many individuals as possible from the total database, including people who have died, emigrated or...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/\" \/>\n<meta property=\"og:site_name\" content=\"microdata.no\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-27T15:39:19+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/hvordan-lage-populasjoner\\\/\",\"url\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/hvordan-lage-populasjoner\\\/\",\"name\":\"How to define and create populations - microdata.no\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/#website\"},\"datePublished\":\"2022-02-11T12:55:58+00:00\",\"dateModified\":\"2023-10-27T15:39:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/hvordan-lage-populasjoner\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/hvordan-lage-populasjoner\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/hvordan-lage-populasjoner\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hjem\",\"item\":\"https:\\\/\\\/www.microdata.no\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to define and create populations\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/#website\",\"url\":\"https:\\\/\\\/www.microdata.no\\\/\",\"name\":\"microdata.no\",\"description\":\"Gj\u00f8r det enklere \u00e5 analysere registerdata\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.microdata.no\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to define and create populations - microdata.no","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/","og_locale":"en_US","og_type":"article","og_title":"How to define and create populations - microdata.no","og_description":"The analysis system microdata.no is based on the left-join principle. This means that the first variable that is created determines the size of the population. If this is a universal variable such as gender, your dataset will consist of as many individuals as possible from the total database, including people who have died, emigrated or...","og_url":"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/","og_site_name":"microdata.no","article_modified_time":"2023-10-27T15:39:19+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/","url":"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/","name":"How to define and create populations - microdata.no","isPartOf":{"@id":"https:\/\/www.microdata.no\/#website"},"datePublished":"2022-02-11T12:55:58+00:00","dateModified":"2023-10-27T15:39:19+00:00","breadcrumb":{"@id":"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.microdata.no\/eksempel\/hvordan-lage-populasjoner\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hjem","item":"https:\/\/www.microdata.no\/en\/"},{"@type":"ListItem","position":2,"name":"How to define and create populations"}]},{"@type":"WebSite","@id":"https:\/\/www.microdata.no\/#website","url":"https:\/\/www.microdata.no\/","name":"microdata.no","description":"Gj\u00f8r det enklere \u00e5 analysere registerdata","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microdata.no\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"taxonomy_info":[],"featured_image_src_large":[],"author_info":[],"comment_info":"","_links":{"self":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/eksempel\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/eksempel"}],"about":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/types\/eksempel"}],"wp:attachment":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/media?parent=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}