Get started – the commands require, create-dataset and import

Step 1: Require

When logged into the microdata.no workdesk for the first time, or when you start a new session, you are met by an empty screen divided in several areas. In order to import variables, you need to use the command require to specify which databank and version to connect to.

Check the button Variables on the main webpage for a list of available databanks and versions.

A click on a databank returns its complete content and how the versions differ (version log).

This is how you write the command require in the analysis area:

require DATABANKNAME:VERSIONSNUMBER as ALIAS

Example:

require no.ssb.fdb:2 as ssb2

By using the space- or tab-key after typing require, a list of available databanks and versions will emerge in a pop-up window (autocomplete-options).

In most cases, one database and one version (Data from Statistics Norway, newest version) is what you need for your session. However, multiple choice is an option, eg. older versions of the same databank or other databanks containing data from other sources (currently not available). You are free to require additional databanks and/or versions throughout the session.

We recommend aliases for the databanks required, making scripting faster and easier to remember.

Step 2: Create-dataset

Having required your data source(s), you need to create your work dataset. You do it with the command create-dataset.

Syntax:

create-dataset NAME_OF_WORK-DATASET

Example:

create-dataset test

Step 3: Import

You will find name and other metadata for all variables in the versions you required in the lower left corner of the screen. The variables are connected to their databanks and versions through a prefix, either the original one, or the alias you chose. You must include this prefix when importing the variable.

microdata.no has multiple import commands. The most common is import, used for imports of data measured at a specific date:

Syntax:

import DATABANKNAME(ALIAS)/VARIABLENAME DATE as ALIAS (option)

Example:

import ssb2/BOSATTEFDT_BOSTED 2015-01-01 as municipality15_v2

All variables in all required databanks and versions are available for import for all datasets created in the session.

(For importing event variables, we refer to the full manual.)

A script example:

require no.ssb.fdb:2 as ssb2
require no.ssb.fdb:1 as ssb1
create-dataset test
import ssb2/BEFOLKNING_KJOENN as sex_V2
import ssb1/BEFOLKNING_KJOENN as sex_V1

Note: You may run require before or after create-dataset, but import is only possible after minimum one require.