[R] Re: Importing a SAS file to R: Alas, STILL more problems--has anyone gotten this message before, and why
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Mon Feb 9 18:10:07 CET 2004
Vincent Carey 525-2265 <stvjc at channing.harvard.edu> writes:
> 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.
...or use various export facilities from the toolbar in SAS for
Windows (availability may or may not require that you have or have not
started the Analyst application...). You can write SPSS .por files
which can be read in R by read.spss, for instance.
Or, create an XPORT library for read.xport with a variation of the
following SAS code snippet.
libname foo xport "foo.xpt";
DATA foo.bar;
set sasuser.bar;
run;
> ---
> Vince Carey
>
> 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
>
--
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
More information about the R-help
mailing list