{"id":3545,"date":"2023-08-03T11:29:05","date_gmt":"2023-08-03T10:29:05","guid":{"rendered":"https:\/\/www.microdata.no\/?post_type=eksempel&#038;p=3545"},"modified":"2023-10-27T16:39:18","modified_gmt":"2023-10-27T15:39:18","slug":"creating-and-modifying-a-dataset","status":"publish","type":"eksempel","link":"https:\/\/www.microdata.no\/en\/eksempel\/creating-and-modifying-a-dataset\/","title":{"rendered":"Creating and modifying a dataset"},"content":{"rendered":"\n<p>You can create a standard wide-format data set by<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>creating a link to a database using the <code>require<\/code> command (only needs to be done once per script),<\/li>\n\n\n\n<li>creating an empty dataset using the <code>create-dataset<\/code> command,<\/li>\n\n\n\n<li>and importing at least one variable into the empty dataset using the <code>import<\/code> command.<\/li>\n<\/ol>\n\n\n\n<p>Unless you have special needs, it is recommended to connect to the latest version of the relevant database. You then get access to all the latest variables and the latest updates. The version number can be found by looking at the top left of the variable overview.<\/p>\n\n\n\n<p>You can only import one variable at a time when creating a wide-format data set through the <code>import<\/code> command. This does two things:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Retrieves data observations for a given time (measurement time is not specified for fixed information such as gender)<\/li>\n\n\n\n<li>Links the data to the current population via a unique built-in unit identifier series (on first import, all observations for the given time are retrieved)<\/li>\n<\/ul>\n\n\n\n<p>It is possible to override the so-called left-join principle by using the import option <code>outer_join<\/code>. Then you will instead retrieve all observations for the given time, also for those that are not already in the data set population. This can be useful if you want to retrieve data on all individuals over a longer period of time (through repeated measurements for a given variable), and not just for those who had an observation at the first measurement time. Chapter 2.3.1 in the User Guide explains more about this.<\/p>\n\n\n\n<p>After the dataset is created, it can be modified as needed. For example, you can rename datasets or variables, remove variables, or remove observations.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n<div id=\"rose-block_4da6a0ffe51549541fc3cfbf8d25fa94\" class=\"rose-code codeblock-wrapper\">\n<pre tabindex=\"0\" class=\"codeblock\"><code>require no.ssb.fdb:23 as db\r\n\r\ncreate-dataset demografidata\r\nimport db\/BEFOLKNING_KJOENN as kj\u00f8nn\r\nimport db\/BEFOLKNING_FOEDSELS_AAR_MND as faarmnd\r\nimport db\/SIVSTANDFDT_SIVSTAND 2020-01-01 as sivstand\r\nimport db\/INNTEKT_BRUTTOFORM 2020-01-01 as formue\r\n\r\n\/\/ Endrer navn p\u00e5 variabler ved \u00e5 legge til \u00e5rsangivelse\r\nrename sivstand sivstand20\r\nrename formue formue20\r\n\r\n\/\/ Sletter variabelen kjonn fra datasettet\r\ndrop kj\u00f8nn\r\n\r\n\/\/ Beholder kun gifte personer i datasettet\r\nkeep if sivstand20 == '2'<\/code><\/pre>\n<\/div>","protected":false},"parent":0,"menu_order":4,"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-3545","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>Creating and modifying a dataset - 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\/opprette-og-endre-et-datasett\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating and modifying a dataset - microdata.no\" \/>\n<meta property=\"og:description\" content=\"You can create a standard wide-format data set by Unless you have special needs, it is recommended to connect to the latest version of the relevant database. You then get access to all the latest variables and the latest updates. The version number can be found by looking at the top left of the variable...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microdata.no\/eksempel\/opprette-og-endre-et-datasett\/\" \/>\n<meta property=\"og:site_name\" content=\"microdata.no\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-27T15:39:18+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/opprette-og-endre-et-datasett\\\/\",\"url\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/opprette-og-endre-et-datasett\\\/\",\"name\":\"Creating and modifying a dataset - microdata.no\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/#website\"},\"datePublished\":\"2023-08-03T10:29:05+00:00\",\"dateModified\":\"2023-10-27T15:39:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/opprette-og-endre-et-datasett\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/opprette-og-endre-et-datasett\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/opprette-og-endre-et-datasett\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hjem\",\"item\":\"https:\\\/\\\/www.microdata.no\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating and modifying a dataset\"}]},{\"@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":"Creating and modifying a dataset - 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\/opprette-og-endre-et-datasett\/","og_locale":"en_US","og_type":"article","og_title":"Creating and modifying a dataset - microdata.no","og_description":"You can create a standard wide-format data set by Unless you have special needs, it is recommended to connect to the latest version of the relevant database. You then get access to all the latest variables and the latest updates. The version number can be found by looking at the top left of the variable...","og_url":"https:\/\/www.microdata.no\/eksempel\/opprette-og-endre-et-datasett\/","og_site_name":"microdata.no","article_modified_time":"2023-10-27T15:39:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.microdata.no\/eksempel\/opprette-og-endre-et-datasett\/","url":"https:\/\/www.microdata.no\/eksempel\/opprette-og-endre-et-datasett\/","name":"Creating and modifying a dataset - microdata.no","isPartOf":{"@id":"https:\/\/www.microdata.no\/#website"},"datePublished":"2023-08-03T10:29:05+00:00","dateModified":"2023-10-27T15:39:18+00:00","breadcrumb":{"@id":"https:\/\/www.microdata.no\/eksempel\/opprette-og-endre-et-datasett\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microdata.no\/eksempel\/opprette-og-endre-et-datasett\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.microdata.no\/eksempel\/opprette-og-endre-et-datasett\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hjem","item":"https:\/\/www.microdata.no\/en\/"},{"@type":"ListItem","position":2,"name":"Creating and modifying a dataset"}]},{"@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\/3545","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=3545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}