[R] problems with read.ssd in foreign

Michael Friendly friendly at yorku.ca
Wed Nov 13 17:18:57 CET 2002

I'm trying to read in a sas system file (.sas7bdat) created
under SAS 8.2 using read.ssd as follows:

> library(foreign)
> libname <- "c:/sasuser/consult/"
> sascmd <- "c:/Program\ Files/SAS\ Institute/SAS/V8/sas.exe"
> subset <- read.ssd(libname, "subset", sascmd=sascmd)
SAS failed.  SAS program at c:\windows\TEMP\Rtmp6673\file24544.sas 
a log and other error products should be in the vicinity
Warning messages: 
1: c:/Program not found 
2: SAS return code was -1 in: read.ssd(libname, "subset", sascmd =

sas.exe is not on my path, and I've tried variious ways to
enter the path to sas.exe allowing for the spaces, without success.
Am I missing something?  Is it true that R cannot deal with
path names containing spaces?

I was able to create an xport file from SAS, and read this with

subset<- read.xport("c:/sasuser/consult/subset.xport")

However, I encountered problems in SAS which might need to be
taken into account in read.ssd.  Under SAS V8, variable names
can be up to 32 characters, but the PROC COPY (which is used
in read.ssd will fail, unless the SAS option, validvarname=V6
is used, as in:

libname rd 'c:\sasuser\consult';
libname subset xport "c:\sasuser\consult\subset.xport";
options validvarname=v6;
proc copy in=rd out=subset;
    select subset;


Michael Friendly              friendly at yorku.ca
York University               http://www.math.yorku.ca/SCS/friendly.html
Psychology Department
4700 Keele Street             Tel:  (416) 736-5115 x66249
Toronto, Ontario, M3J 1P3     Fax:  (416) 736-5814
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list