[R] Re: Importing a SAS file to R: Alas, STILL more problems--has anyone gotten this message before, and why

Frank E Harrell Jr feh3k at spamcop.net
Mon Feb 9 18:53:08 CET 2004


On Mon, 9 Feb 2004 11:37:57 -0500 (EST)
Vincent Carey 525-2265 <stvjc at channing.harvard.edu> wrote:

> i am the author of read.ssd, and did not accommodate sas for
> windows in the creation of that function.  i do not know how
> sas is called under windows, but it is possible that if you
> learn how to invoke sas through the R "system" command, you
> can supply the invocation command as the "sascmd" parameter
> to read.ssd
> 
> other ways of transferring the information from SAS to R
> include 1) using a put statement to write the data out record
> by record into a whitespace delimited file, and then using
> read.table in R to collect the data for use in R, 2) using
> read.ssd on a unix system, saving the resulting R object,
> and then transferring the R object back to windows.
> 
> ---
> Vince Carey

Also take a look at the sas.get and sasxport.get (which calls read.xport)
functions in the Hmisc package.

Frank

> 
> On Mon, 9 Feb 2004, Shoultz, Gerald wrote:
> 
> > Sorry to write twice in one day--I am a relative newbie to some of
> > these parts of R, and I am pulling my hair out!  B/c I am preparing a
> > file to use WINBUGS I am cross-posting to the BUGS group as well, in
> > case anyone there has some ideas on this.
> >
> > I've got a large SAS dataset that I want to put in R form to more
> > easily use the file with the hierarchical modeling software WINBUGS.
> > It has numerous variables, so setting up "vertical text files" could
> > be awkward. I did get the library foreign installed OK.  I am now
> > trying to run read.ssd.  What I have below is similar to that found in
> > the documentation for the foreign package, p.9:
> >
> > >  list.files("C:/Project_data/WINBUGSfiles")
> > [1] "lastfile.sas7bdat"
> > > dtabunch<-read.ssd("C:/Project_data/WINBUGSfiles","lastfile")
> >
> > I unfortunately got this:
> >
> > SAS failed.  SAS program at
> > C:\DOCUME~1\bjz9\LOCALS~1\Temp\Rtmp23335\file29621.sas
> > a log and other error products should be in the vicinity
> > Warning messages:
> > 1: sas not found
> > 2: ls not found
> > 3: SAS return code was -1 in: read.ssd("C:/Project_data/WINBUGSfiles",
> > "lastfile")
> >
> > I have tried to find the log file but have been unable to do so.Can
> > someone who has had this happen before kindly tell me what exactly (or
> > possibly) is going on?  I went to the SAS Technical Support Document
> > TS-140 to try to get help and really didn't get much out of that. 
> > Does anyone know a better (as in "foolproof/will avoid meaningless
> > error messages") way to get a SAS dataset into R-format?  Any help on
> > this would be most appreciated.
> >
> > Thanks!
> >
> > Gerald Shoultz
> >
> >
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html


---
Frank E Harrell Jr   Professor and Chair           School of Medicine
                     Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list