importDREAM | R Documentation |
The DREAM dataset is a SAS dataset where all in the Danish population that have received public support are recorded. A number of variables are presented. For a detailed description of DREAM refer to www.dreammodel.dk
The current function can output 2 datasets from the DREAM database
support A long version data.table providing a sequential list of time periods and the codes for public support. Description of codes can be identified a number of places and for those working on Statistics Denmark there are SAS format codes available
branche A long version data.table providing a record per month for type of profession with start/end/work-code. SAS formats are also available for these codes
importDREAM(dreamData,type="support",pnr="pnr",explData=NULL,)
dreamData |
Name of dataset holding DREAM data. Typically product of the importSAS function. In most cases it will be useful to add a set.hook to the importSAS function - set.hook="keep PNR branch:" for type of work and set.hook="keep=PNR y_:" for support |
type |
- "support" extracts weekly public support and "branche" supplies montly type of work. Other names cause error. |
pnr |
- name of person identifier in DREAM dataset, typically "PNR" |
explData |
Name of data holding relation between codes and explanatory text. Typically read from "//srvfsenas1/formater/SAS formater i Danmarks Statistik/txt_filer" using "read.csv2". The data is expected to hold two variables: the code and the explanation - in that order. The variable holding the code MUST be named "branche" or "support" as appropriate. |
DREAM data are organized in a special way. From the start of recording there is a weekly recording of receipt of support from the state. These are in se- parate variables. Then there is a montly recording of type of work also in separate variables. Other data are in DREAM, but not extracted by current function which either selects public support or type of work. The result is either occupation (branche) or support-type with start and end dates and in long format.
the function returns a data.table with the following variables:
pnr - person identificer from call
start - start of each period
end - end of each period
code - coding of period
explanation - text to eplain coding if a text dataset was specified
Christian Torp-Pedersen
importSAS
# The following is a minute version of DREAM
library(data.table)
microDREAM <-data.table(PNR=c(1,2),branche_2008_01=c("","3"),
branche_2008_02=c("1","3"), branche_2008_03=c("1",""),
y_9201=c("","1"),y_9202=c("","2"),y_9203=c("","2"))
# Explanation of codes for "branche"
branche <- data.table(branche=c("1","2","3"),
text=c("school","gardening","suage"))
support <- data.table(support=c("1","2"),text=c("education","sick"))
temp <- importDREAM(microDREAM,type="branche",pnr="PNR",explData=branche)
temp[]
temp2 <- importDREAM(microDREAM,type="support",pnr="PNR",explData=support)
temp2[]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.