[R] importing SAS data

Marc Schwartz MSchwartz at medanalytics.com
Wed Oct 29 17:53:15 CET 2003


It is not explicitly stated in the help for read.ssd(), but the
description says:

"generates a SAS program to convert the ssd contents to SAS transport
format and then uses read.xport to obtain a dataframe"

I would imagine that "generates a SAS program" implies that SAS itself
must be available to actually run the program.

Presuming that Paul has SAS on his machine or is otherwise directly
accessible, he likely needs to add the path to sas.exe to his 'PATH'
variable under Windows.

Also, Paul did not indicate which version of Windows he is using. I know
XP had an 'ls' command, but I don't recall if the prior versions did or
did not. 'ls' is more common to Unix/Linux.

An alternative to this would be Frank Harrell's sas.get() in the Hmisc
library if you cannot get read.ssd() to work. sas.get() also requires
SAS to be installed and in the 'PATH'.

HTH,

Marc Schwartz

On Wed, 2003-10-29 at 10:33, Thomas W Blackwell wrote:
> Paul  -
> 
> I think you have to have an executable copy of SAS on the
> same machine as R in order for this to work.  I've never
> used it, but I remember a very similar question on the
> list from just a few months ago.  Maybe there's some
> description of this in the foreign package manual, or in
> the help pages.
> 
> -  tom blackwell  -  u michigna medical school  -  ann arbor  -
> 
> On Wed, 29 Oct 2003, Paul Green wrote:
> 
> > I am trying to import a permanent SAS data
> > set using read.ssd in the foreign library. I get
> > the following error:
> >
> >  > list.files("C:/temp")
> > [1] "newdat1.sas7bdat" "snpm1.sas7bdat"   "test1.sas"
> >  > library(foreign)
> >  > newdat1 <- read.ssd("C:/temp","newdat1")
> > SAS failed.  SAS program at
> > C:\DOCUME~1\paul\LOCALS~1\Temp\Rtmp21143\file30218.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:/temp", "newdat1")
> >
> > I can export the SAS data as a tab delimited file and then read
> > it into R with read.delim, but I have many SAS files I need to
> > look at. Does anyone have experience with this?
> >
> > Thanks
> >
> > Paul Green




More information about the R-help mailing list