> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Andrew Miles
> Sent: Wednesday, October 20, 2010 10:10 AM
> To: r-help@r-project.org
> Subject: [R] Problem exporting data using write.foreign
> 
> My question is about the write.foreign() command in the foreign
> package.  I use a command like the following to try and output data
> and a code file to read my data into SAS.
> 
> write.foreign(data.frame.object, datafile="filepath",
> codefile="filepath", package="SAS", dataname="myData")
> 
> With my data set, it gives the following error:
> 
> Error in make.SAS.names(names(df), validvarname = validvarname) :
>    Cannot uniquely abbreviate the variable names to 32 or fewer
> characters
> 
> I tried to write reproducible code but could not.  I'm not sure where
> to go from here.  What are the naming protocols for variables so that
> they can be exported using write.foreign()?
> 
> Thanks!
> 
> Andrew Miles
> 

Well, the error message tells you that the names must be unique when truncated 
to 32 characters.  Apparently, you have at least 2 variables that have the same 
name when truncated to 32 characters.

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to