Dear all, First of all, I thank you for the creation of the package.
I write this message concerning the write.foreign() function from the foreign package and a bug that I discovered. When we want to save our dataset as a .sas file, the limit of variable names character is 8 by default. In SAS this limit is 32 character and an argument in the function, validvarname, can theorically switch the default from 8 to 32 by selecting validvarname = "V7". However, it did not work and show the error "Cannot uniquely abbreviate format names to conform to eight-character limit and not ending in a digit" that show the limit is still 8 characters. By looking at the script at https://github.com/cran/foreign/blob/master/R/writeForeignSAS.R , I realized that the line 39, in the function make.SAS.formats, can be the reason of the nonfunctioning argument : "if(any(nchar(x) > 8L) || any(duplicated(x)))" which is correct if the length of the variable has a limit of 8, but it does not take in consideration when the limit is at 32 defined by validvarnames = "V7". A solution can be to add the argument validvarname in the definition of the function and add these few lines : validvarname <- match.arg(validvarname) nmax <- if(validvarname == "V7") 32L else 8L if(any(nchar(x) > nmax) || any(duplicated(x))) I hope I send the message to the good place and that it will help you improve the package. Kind regards, Julien Joly Biostatisticien et Data manager [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.