On Mon, 26 Sep 2005, Dean Sonneborn wrote:
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 time0.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 time0.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 time0.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?
I suggest you read the help file for read.ssd. You are not telling it
where the SAS files are correctly. See the extracts below and the
examples.
Usage:
read.ssd(libname, sectionnames,
tmpXport=tempfile(), tmpProgLoc=tempfile(), sascmd=sas)
Arguments:
libname: character string defining the SAS library (usually a
directory reference)
sectionnames: character vector giving member names. These are files in
the 'libname' directory. They will usually have a '.ssd0x' or
'.sas7bdat' extension, which should be omitted.
The files are not in the SAS homne directory, but the `default R
directory' (perhaps you mean the working directory?).
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
PLEASE do!
--
Brian D. Ripley, [EMAIL PROTECTED]
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax: +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html