{"id":1285,"date":"2022-02-14T12:21:24","date_gmt":"2022-02-14T11:21:24","guid":{"rendered":"https:\/\/microdata.spirehost.no\/?post_type=eksempel&#038;p=1285"},"modified":"2023-08-18T13:31:06","modified_gmt":"2023-08-18T12:31:06","slug":"merge-job-data-into-individual-level-datasets","status":"publish","type":"eksempel","link":"https:\/\/www.microdata.no\/en\/eksempel\/merge-job-data-into-individual-level-datasets\/","title":{"rendered":"Merge job data into individual level datasets"},"content":{"rendered":"\n<p>The example below demonstrates how to link data with Employment as the entity type with another dataset with Person as the entity type.<\/p>\n\n\n\n<p>Data from the so-called \u201cA scheme\u201d with the prefix &#8220;<em>ARBLONN_ARB_<\/em>&#8221; has Employment as unit type (i.e. up to several records per person). To be able to link such data together with normal personal data sets, one must first use the command <code>collapse<\/code> to sum up the information related to each individual employment relationship. The data set then has Person as the unit type (one record per person), and can thus be linked with the personal data set &#8220;employed&#8221;.<\/p>\n\n\n<div id=\"rose-block_7d3a498e3882b8034367e6b82f9af10f\" class=\"rose-code codeblock-wrapper\">\n<pre tabindex=\"0\" class=\"codeblock\"><code>\/\/Connect to database\r\nrequire no.ssb.fdb:23 as db\r\n\r\n\/\/Create employees dataset (person data)\r\ncreate-dataset employees\r\nimport db\/ARBLONN_PERS_KJOENN 2021-07-16 as gender\r\nimport db\/ARBLONN_PERS_ALDER 2021-07-16 as age\r\n\r\n\/\/Create employment dataset (job data)\r\ncreate-dataset employment\r\nimport db\/ARBLONN_ARB_ARBEIDSTID 2021-07-16 as work_hours\r\nimport db\/ARBLONN_ARB_STILLINGSPST 2021-07-16 as empl_pct\r\nimport db\/ARBEIDSFORHOLD_PERSON as personid\r\n\r\n\/\/Aggregate from job data to person data by adding up work hours and employment precentages per person. Then link job data into the person dataset employees\r\ncollapse (sum) work_hours empl_pct, by(personid)\r\nmerge work_hours empl_pct into employees\r\n\r\n\/\/Generate job statistics\r\nuse employees\r\n\r\nsummarize work_hours empl_pct\r\ntabulate gender, summarize(work_hours)\r\ntabulate gender, summarize(empl_pct)\r\n\r\ngenerate agegr = 1\r\nreplace agegr = 2 if age > 25\r\nreplace agegr = 3 if age > 40\r\nreplace agegr = 4 if age > 60\r\ndefine-labels agelabel 1 '0-25' 2 '26-40' 3 '41-60' 4 '61->'\r\nassign-labels agegr agelabel\r\ntabulate agegr\r\ntabulate agegr gender, summarize(work_hours)\r\ntabulate agegr gender, summarize(empl_pct)<\/code><\/pre>\n<\/div>","protected":false},"parent":0,"menu_order":110,"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-1285","eksempel","type-eksempel","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Merge job data into individual level datasets - 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\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Merge job data into individual level datasets - microdata.no\" \/>\n<meta property=\"og:description\" content=\"The example below demonstrates how to link data with Employment as the entity type with another dataset with Person as the entity type. Data from the so-called \u201cA scheme\u201d with the prefix &#8220;ARBLONN_ARB_&#8221; has Employment as unit type (i.e. up to several records per person). To be able to link such data together with normal...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microdata.no\/eksempel\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/\" \/>\n<meta property=\"og:site_name\" content=\"microdata.no\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-18T12:31:06+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\\\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\\\/\",\"url\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\\\/\",\"name\":\"Merge job data into individual level datasets - microdata.no\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/#website\"},\"datePublished\":\"2022-02-14T11:21:24+00:00\",\"dateModified\":\"2023-08-18T12:31:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hjem\",\"item\":\"https:\\\/\\\/www.microdata.no\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Merge job data into individual level datasets\"}]},{\"@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":"Merge job data into individual level datasets - 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\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/","og_locale":"en_US","og_type":"article","og_title":"Merge job data into individual level datasets - microdata.no","og_description":"The example below demonstrates how to link data with Employment as the entity type with another dataset with Person as the entity type. Data from the so-called \u201cA scheme\u201d with the prefix &#8220;ARBLONN_ARB_&#8221; has Employment as unit type (i.e. up to several records per person). To be able to link such data together with normal...","og_url":"https:\/\/www.microdata.no\/eksempel\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/","og_site_name":"microdata.no","article_modified_time":"2023-08-18T12:31:06+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\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/","url":"https:\/\/www.microdata.no\/eksempel\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/","name":"Merge job data into individual level datasets - microdata.no","isPartOf":{"@id":"https:\/\/www.microdata.no\/#website"},"datePublished":"2022-02-14T11:21:24+00:00","dateModified":"2023-08-18T12:31:06+00:00","breadcrumb":{"@id":"https:\/\/www.microdata.no\/eksempel\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microdata.no\/eksempel\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.microdata.no\/eksempel\/koble-sammen-data-om-arbeidsforhold-pa-persondatasett\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hjem","item":"https:\/\/www.microdata.no\/en\/"},{"@type":"ListItem","position":2,"name":"Merge job data into individual level datasets"}]},{"@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\/1285","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=1285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}