a program for exporting sas datasets to argus johan heldal statistics norway

6
A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway

Upload: brandon-bell

Post on 18-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway

A program for exporting SAS datasets to Argus

Johan Heldal

Statistics Norway

Page 2: A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway

SAS macro TOARGUS

• Reads a SAS dataset

• Outputs a .csv file, ’;’ separated

• Creates an ARGUS meta data file (.rda)– Applies to both Mu and Tau

• Creates an INPUT statement (.sas) for reading a safe file from Mu back to SAS.

• An open code for anybody to improve.

Page 3: A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway

How to run TOARGUS%LET LIBNAME = NIH; * The libname for the SAS dataset;%LET INPATH = REMOTE

'$METODER/1253/NIH_kartlegging/wk12' SERVER=ovibos; * Path to the SAS dataset;

%LET DATASET = utvalg; * The name of the SAS dataset;%LET OUTPATH = H:\ESSnet\Confidentiality; * Directory for .csv and .rda files;%LET KEEP = t_senter kjonn barn sivstand samtykke retur res

utland land fylke alder; * The variables to be transferred;/*Run the macro.*/%INCLUDE "H:\ESSnet\Confidentiality\SAS-Argus\ToArgus.sas";%TOARGUS;

Page 4: A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway

The metafile (utvalg.rda)<SEPARATOR> ";"t_senter 2 <RECODABLE>kjonn 1 <RECODABLE>barn 8 .<NUMERIC>sivstand 1 <RECODABLE>samtykke 1 <RECODABLE>retur 1 <RECODABLE>res 1 <RECODABLE>utland 4 <RECODABLE>land 4 <RECODABLE>fylke 4 <RECODABLE>alder 8 .<NUMERIC>

• Metadata specific for confidentiality should be specified in ARGUS

• i.e. sample weight, holding indicator, request, household identifier, suppressweight etc.

Page 5: A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway

The input file (.sas)INFILE &OUTPATH\&DATASET..saf DELIMITER=';' DSD;INPUTt_senter : $CHAR2.kjonn : $CHAR1.barn : 8.sivstand : $CHAR1.samtykke : $CHAR1.retur : $CHAR1.res : $CHAR1.utland : $CHAR4.land : $CHAR4.fylke : $CHAR4.alder : 8.;

Page 6: A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway

Next to do

• Write code for generation of codelist files (.cdl) from associated SAS-formats.

• Write SAS macro for generation of tabular input to Tau. – The table with relevant information and

metafile.