[R] reading SAS data files

Dean Sonneborn
Mon, 26 Sep 2005 17:00:49 -0000

I am attempting to read in a SAS 9.1 data file. After starting R I
change to the directory containing the sas data file and use the "dir"
command to confirm that it is there. Then I run the following R-code:

library(foreign)

sashome <- "/Program Files/SAS/SAS 9.1"

test<-read.ssd(file.path(sashome), "pcb",

         sascmd = file.path(sashome, "sas.exe"))


	but R responds with:

SAS failed.  SAS program at
C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file16169.sas
The log file will be file16169.log in the current directory
Warning message:
SAS return code was 2 in: read.ssd(file.path(sashome), "pcb", sascmd =
file.path(sashome,


 	the SAS log file contain this:

NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)
      Licensed to UNIV OF CA/DAVIS, Site 0029107010.
NOTE: This session is executing on the XP_PRO  platform.



NOTE: SAS initialization used:
      real time           0.13 seconds
      cpu time            0.18 seconds

1          libname src2rd '/Program Files/SAS/SAS 9.1';
NOTE: Libref SRC2RD was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Program Files\SAS\SAS 9.1
2          libname rd xport
'C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file26090';
NOTE: Libref RD was successfully assigned as follows:
      Engine:        XPORT
      Physical Name: C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file26090
3          proc copy in=src2rd out=rd;
4          select pcb ;
ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a SELECT
statement.
ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a SELECT
statement.
ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a SELECT
statement.
WARNING: Input library SRC2RD is empty.
NOTE: Statements not processed because of errors noted above.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE COPY used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


ERROR: Errors printed on page 1.
ERROR: Errors printed on page 1.
ERROR: Errors printed on page 1.

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           0.16 seconds
      cpu time            0.20 seconds

Does anyone see what I am doing incorrectly and can they offer any suggestions
about getting this to run correctly?
 I'm not sure where SAS is expecting to find the data file. I have it in the
default R directory. Is this where
SAS is looking for it or does it need to be somewhere else?

Thanks,


--
Dean Sonneborn
Programmer Analyst
Department of Public Health Sciences
University of California, Davis
(916) 734-6656


	[[alternative HTML version deleted]]