Hello, 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! thanks. Arnab ------------- Ph.D. Candidate RAND Graduate School Santa Monica
Have you considered "write.table"? hope this helps. spencer graves Arnab mukherji wrote:>Hello, > > 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! > >thanks. > >Arnab > > >------------- >Ph.D. Candidate >RAND Graduate School >Santa Monica > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >
On Tue, 4 Nov 2003, Arnab mukherji wrote:> Hello, > > 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) >It's not clear whether you want value labels or variable labels. Variable labels don't get exported to stata, but factor levels do get exported as value labels. Eg data(esoph) write.dta(esoph, file="esoph.dta",version=7) -thomas