Learn R Programming

readstata13 (version 0.8.5)

save.dta13: Write Stata Binary Files

Description

save.dta13 writes a Stata dta-file bytewise and saves the data into a dta-file.

Usage

save.dta13(data, file, data.label = NULL, time.stamp = TRUE, convert.factors = TRUE, convert.dates = TRUE, tz = "GMT", add.rownames = FALSE, compress = FALSE, version = 117, convert.underscore = FALSE)

Arguments

data
data.frame. A data.frame Object.
file
character. Path to the dta file you want to export.
data.label
character. Name of the dta-file.
time.stamp
logical. If TRUE, add a time.stamp to the dta-file.
convert.factors
logical. If TRUE, factors will be converted to Stata variables with labels. Stata expects strings to be encoded as Windows-1252, so all levels will be recoded. Character which can not be mapped in Windows-1252 will be saved as hexcode.
convert.dates
logical. If TRUE, dates will be converted to Stata date time format. Code from foreign::write.dta
tz
character. The name of the timezone convert.dates will use.
add.rownames
logical. If TRUE, a new variable rownames will be added to the dta-file.
compress
logical. If TRUE, the resulting dta-file will use all of Statas numeric-vartypes.
version
numeric. Stata format for the resulting dta-file either the internal Stata dta-format (e.g. 117 for Stata 13) or versions 6 - 14.
convert.underscore
logical. If TRUE, in variable names dots will be converted to underscores.

Value

The function writes a dta-file to disk. The following features of the dta file format are supported:

References

Stata Corp (2014): Description of .dta file format http://www.stata.com/help.cgi?dta

See Also

read.dta in package foreign and memisc for dta files from Stata versions < 13 and read_dta in package haven for Stata version >= 13.