help for opendf csv2dta (opendf_csv2dta) version 2.0.21 (28 August 2024)

opendf_csv2dta -- builds a Stata dataset (.dta) from csv files containing meta data for survey data.

Syntax

opendf_csv2dta,
csv_loc()
[ rowrange([start][:end]) colrange([start][:end])} clear save() replace verbose]

options

csv_loc(string) Indicates location of csvs.

rowrange([start][:end]) Indicates the range of rows to read.

colrange([start][:end]) Indicates the range of columns to read.

clear allows you to clear dataset in memory

save(string) save data to desired filepath and filename.

replace overwriting former saved file

verbose More warnings are displayed.

Description

opendf_csv2dta Transforms survey data from several csv files into dta-format including metadata saved in labels and characteristics.

csv_loc is a path to a folder where 4 csvs have to be included that contain data and metadata.

The file containing the data has to be named data.csv

The file containing the metadata for the datset has to be named dataset.csv

The file containing the metadata for the variables has to be named variables.csv

The file containing the metadata for the values has to be named categories.csv

Metadata information is saved as labels or characteristics.

rowrange([start][end])} specifies a range of rows within the data to load (excluding the header). start and end are integer row numbers.

colrange([start][end])} specifies a range of variables within the data to load. start and end are integer column numbers.

clear specifies that it is okay to replace the data in memory, even though the current data have not been saved to disk.

replace overwrite existing file.

replace indicates that any existing file should be overwritten.

save stores data to a desired filepath and filename.

verbose display more warnings.

Remarks

This command from the opendf package is part of the Open Data Format Project bundle, written to assist with survey data files in the open data format(.zip).

Examples

Builds a Stata dataset containing metadata in the characteristics and the labels from the four csvs located in "C:/Documents/Data".

. opendf_csv2dta, csv_loc("C:/Documents/Data")

Author

Tom Hartl (thartl@diw.de), Deutsches Institut für Wirtschaftsforschung Berlin.

Also see

Help: opendf_read, opendf_write, opendf_docu opendf_csv2zip