Instructions for storing data

1 Prepare data material for storage

1.1 Data material solely from IFAU data bases

Data material solely based on information from IFAU data bases can be submitted for storage in one of the below forms:

  • Original format (Stata, SAS, GAUS, R). Description of the item is not required.
  • ASCII-format according to the instructions under heading 2.1 (see description below).

1.2 Data material not solely from IFAU databases

Data material that is not solely from IFAU databases is to be saved as ASCII with a fixed length, i.e. fixed format, fixed positions. Fixed format looks like columns without any delimitations such as comma or semi colon. The columns must not be displaced (note that even if a file separated by tabs might look like this, it is still a file separated by characters where the character delimiter is a tab).

Via Stat Transfer

Data run in Stata, SAS, GAUSS or EXCEL can be transferred to ASCII using Stat Transfer.

  • Choose the programme that has been used in Input file.
  • Indicate the file to be transferred using browse.
  • Choose ASCII – fixed format (S/T Schema) in Output file.
  • Choose place (folder/catalogue) where the ASCII file is to be saved using browse.

In Stat Transfer, a file is also automatically created with a list of variables and positions. If SAS-data contains labels that describe the contents for each respective variable, these will also appear on the generated list of variables.

If you have many files that are to be transferred to ASCII, this is done in the following way:

  • Go to the programme st.exe found in the installation folder for StatTransfer, for example C:\Program Files (x86)\StatTransfer8\st.exe
  • Set the search path to the folder for your datafiles,
    for example. cd P:\year\no\data\basicdata
  • Write from which format and to which format you wish to transfer,
    for example copy *.dta *.sts /O-

Adding ”/O-” indicates that StatTransfer should not use optimisation of data types in the transfer.

Via a statistics software

Stata

Open the data file and execute the command “compress”, which transforms and compresses the data file so that no variables have more positions than what is necessary.

Save the file using the command “outfile using filnamn,wide” without any file extension, for example outfile using D:\data\filnamne,wide.

Use the command “describe” in Stata in order to obtain an item description of a dataset.

SAS

proc export
data= datasettobeexported/* here you write what data set you want to export, for example “datasettobeexported” */
outfile="D:\searchpath_foryour_file\nameofdataset.txt" /* Here you write the search path and the name of the file */
dbms =dlm replace;
run;

GAUSS

indata = ”name of data file” ;
open f1 = ^inddata;
X= readr(f1,rowsf(f1));
output file = ut.txt reset;
X;
Output off;

R

Exporting from R to Stata:

library(foreign)

load("\\\\enhet\\katalog\\DatafilTillArkivet.Rdata")

write.dta(TableObject," I:\\Data\\DNR\\DataToAchive.dta",version = 7L,convert.dates = TRUE, tz = "GMT",convert.factors = c("labels", "string", "numeric", "codes"))

Then, convert from Stata to ASCII in accordance with the above instructions.

Description of the item

Also create a description of the item file (text with new line) with the name itemdescr.txt. The file should contain the name of the variable, variable type, start and end position for each variable, exact column length, description of variable content and other possible information that is relevant for the description of the item.

2 Documenting and submitting data material for storage NB! Applies for all data material

Information

Create a textfile, with information about the origins of the data material (for example  surveys, Händel, Ams…) and population, what programme that has been used for the analysis and other explanations that you consider to be required.
Save the file, as text with new line, for example in MS-Word
choose the alternative “Unformattedtext”, as the file format. Enter new line.

NB! It is fine to save the item description and information in one and the same file.

Programme

Submit programme codes (for example, .do files in Stata, .sas files in SAS and .e or .sim files in GAUSS) for filing.

Filname/catalogue name

Avoid using long file names. They create problems when burning CDs, for example.

It might be a good idea to replace spacing with underlining (_) and not use characters like Åå, Ää, Öö.

Transmission of data

  • Create a folder on the server, under
    I:\Research projects and cases \ Datamaterial for filing
  • Name the folder ”Reg_no_yyyy” (for example Regno_1_2012).
  • Save the data material in the folder and inform the person in charge of the archives.

Those who do not have access to I, can

  • save data on the server after consulting with the database administrator about a suitable location
  • submit data on CD/DVD/Blu-Ray. If you send it by regular mail, use registered mail.

Contact

For practical matters: Åsa Landqvist, email: asa.landqvist@ifau.uu.se

For research questions: Martin Lundin, email: martin.lundin@ifau.uu.se