Learn R Programming

foreign (version 0.2-8)

write.dta: Write files in Stata binary format

Description

Writes the data frame to file in the Stata v6.0 binary format. Does not write matrix variables.

Usage

write.dta(dataframe, filename)

Arguments

dataframe
a data frame
filename
character string giving filename

Value

  • NULL

Details

The columns in the data frame become variables in the Stata data set. Missing values are correctly handled. Nothing is done with factor levels, which should end up as variable labels.

References

Stata v6.0 Users Manual describes the file format

See Also

read.dta,attributes

Examples

Run this code
data(swiss)
write.dta(swiss,swissfile<-tempfile())
read.dta(swissfile)

Run the code above in your browser using DataLab