Thank you Peter. SAS Universal Viewer can open both SAS datasets. And if I do 
the following in SAS, it will print out the dataset:

libname x 'C:\SASdata';

proc print data=x.a;
run;


Here are what is in the log files:

1. For the one that doesn't work:

> tmp<-read.ssd("C:\\SASdata", "a",sascmd="C:/Program 
>Files/SAS/SASFoundation/9.2/sas.exe")
SAS failed.  
The log file will be file3d6c4ae1.log in the current directory
Warning message:
In read.ssd("C:\\SASdata", "a", sascmd = "C:/Program 
Files/SAS/SASFoundation/9.2/sas.exe") :
  SAS return code was 1

The content of log file "file3d6c4ae1.log":

NOTE: SAS initialization used:
      real time           0.90 seconds
      cpu time            0.31 seconds
      
1          option validvarname = v6;libname src2rd 'C:\SASdata';
NOTE: Libref SRC2RD was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\SASdata
2          libname rd xport 
'C:\DOCUME~1\yiz01\LOCALS~1\Temp\Rtmptznwrt\file678418be';
NOTE: Libref RD was successfully assigned as follows: 
      Engine:        XPORT 
      Physical Name: C:\DOCUME~1\yiz01\LOCALS~1\Temp\Rtmptznwrt\file678418be
3          proc copy in=src2rd out=rd;
4          select a ;
NOTE: Copying SRC2RD.A to RD.A (memtype=DATA).
NOTE: There were 3347 observations read from the data set SRC2RD.A.
NOTE: The data set RD.A has 3347 observations and 52 variables.
WARNING: Labels exceeding length 40 are not supported by engine XPORT and are 
being truncated.
NOTE: PROCEDURE COPY used (Total process time):
      real time           2.75 seconds
      cpu time            0.09 seconds
      

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


It only has an warning about the label exceeding length 40, but has no error 
message. And it even appears that it has read in 3347 observations and 52 
variables.

2. For the one that worked:
> tmp<-read.ssd("C:\\SASdata", "b",sascmd="C:/Program 
>Files/SAS/SASFoundation/9.2/sas.exe")

The content of the log file is:

NOTE: SAS initialization used:
      real time           0.59 seconds
      cpu time            0.17 seconds
      
1          option validvarname = v6;libname src2rd 'C:\SASdata';
NOTE: Libref SRC2RD was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\SASdata
2          libname rd xport 
'C:\DOCUME~1\yiz01\LOCALS~1\Temp\Rtmptznwrt\file72ae2cd6';
NOTE: Libref RD was successfully assigned as follows: 
      Engine:        XPORT 
      Physical Name: C:\DOCUME~1\yiz01\LOCALS~1\Temp\Rtmptznwrt\file72ae2cd6
3          proc copy in=src2rd out=rd;
4          select b ;
NOTE: Copying SRC2RD.B to RD.B (memtype=DATA).
NOTE: Data file SRC2RD.B.DATA is in a format that is native to another host, or 
the file encoding does not match the session 

      encoding. Cross Environment Data Access will be used, which might require 
additional CPU resources and might reduce 

      performance.
NOTE: The variable name study_eye has been truncated to study_ey.
NOTE: The variable study_ey now has a label set to study_eye.
NOTE: The variable name OCSHEVA_dec has been truncated to OCSHEVA_.
WARNING: Engine XPORT does not support SORTEDBY operations.  SORTEDBY 
information cannot be copied.
NOTE: There were 3574 observations read from the data set SRC2RD.B.
NOTE: The data set RD.B has 3574 observations and 62 variables.
NOTE: PROCEDURE COPY used (Total process time):
      real time           1.81 seconds
      cpu time            0.42 seconds
      

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



Thank you!

John




________________________________
From: peter dalgaard <pdalgd@gmail.com>

Cc: r-help@r-project.org
Sent: Sun, March 6, 2011 1:51:51 AM
Subject: Re: [R] read.ssd()  from foreign package


On Mar 6, 2011, at 09:34 , array chip wrote:

> Hi, I am encountering a confusing problem when I tried to use read.ssd to read 

> SAS datasets. For one SAS dataset "a.sas7bdat", it did not work; while for 
> another SAS dataset "b.sas7bdat" it worked:
> 
>> tmp<-read.ssd("C:\\SASdata", "a",sascmd="C:/Program 
>> Files/SAS/SASFoundation/9.2/sas.exe")
> SAS failed.  SAS program at 
> C:\DOCUME~1\yiz01\LOCALS~1\Temp\RtmpVjJa6m\file12384509.sas 
> 
> The log file will be file12384509.log in the current directory
> Warning message:
> In read.ssd("C:\\SASdata", "a", sascmd = "C:/Program 
> Files/SAS/SASFoundation/9.2/sas.exe") :
>  SAS return code was 1
> 
>> tmp<-read.ssd("C:\\SASdata", "b",sascmd="C:/Program 
>> Files/SAS/SASFoundation/9.2/sas.exe")
> 
> The attached log files are also attached.

Nope... Presumably, your mailer encoded them as non-text and the mailing list 
software scrubbed them.

Try inlining them. Not much we can do without an error message to go on. 

(I gather, by the way, that even SAS itself has trouble reading SAS files these 
days due to 32/64 bit issues. So my first question would be whether SAS can read 
both files.)


> File "file12384509.log" is for dataset 
> "a.sas7bdat" that does not work; while file "file1ad46e5d.log" is for dataset 
> "b.sas7bdat" that does work.
> 
> Can anyone suggest why one worked, the other did not?
> 
> Thanks
> 
> John
> 
> 
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes@cbs.dk  Priv: PDalgd@gmail.com


      
	[[alternative HTML version deleted]]

