[R] write.dta and handling labels

Arnab mukherji arnab at myrealbox.com
Tue Nov 4 01:10:16 CET 2003


 I need to write out a data matrix as a STATA 7 file and this happens perfectly with write.dta(), except I cannot seem to export the labelnames to Stata. 

 So far I have tried the following:
# X is the data matrix that is to be exported
attributes(X)$var.labels <- c("apple", "banana", "cat")
write(X, filename = "text.dta", version = 7)

When i open the file in stata instead of the label names all I get are the variable names, when i ask stata to "describe" the data.

I am hoping someone can suggest ways in which i can export the label names more effectively!



Ph.D. Candidate
RAND Graduate School 
Santa Monica

More information about the R-help mailing list