I have found that data imported from SAS using read.xport() in package foreign (installed recently) does not match the original data, when the data consists of character strings that are only one character long. Here is an example. ---- SAS commands to create the data ---- options nocenter; data foo; a='a'; b='bb'; length c d $2; c='c'; d=' d'; x=3.1; output; run; proc print data=foo; run; libname xpt xport 'xpt.foo'; proc copy in=work out=xpt memtype=data; select foo; run; proc contents data=foo; run; ---------- output from proc print ------- OBS A B C D X 1 a bb c d 3.1 --------- in R -------------> foo <- read.xport('xpt.foo') > > fooA B C D X 1 bb d 3.1 note that neither foo$A nor foo$C has any data. --------- version information --------- NOTE: SAS (r) Proprietary Software Release 6.12 TS020> version_ platform sparc-sun-solaris2.7 arch sparc os solaris2.7 system sparc, solaris2.7 status major 1 minor 4.1 year 2002 month 01 day 30 language R> tmp <- installed.packages() > tmp[tmp[,1]=='foreign',,drop=FALSE]Package LibPath Version Priority Bundle Depends [1,] "foreign" "/erd/statistic/apps/R/R-1.4.1/lib/R/library" "0.4-9" -Don -- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA -------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2002-Apr-26 19:02 UTC
[R] Problem with read.xport() from foreign package
Don MacQueen <macq at llnl.gov> writes:> I have found that data imported from SAS using read.xport() in package > foreign (installed recently) does not match the original data, when > the data consists of character strings that are only one character > long.This sounds very much like a bug that got fixed a short while ago. You might try updating to the latest version. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._