[R] importing sas datasets

John Kane jrkrideau at yahoo.ca
Sat Apr 21 13:42:47 CEST 2007


--- Daniel Nordlund <res90sx5 at verizon.net> wrote:

> > -----Original Message-----
> > From: John Kane [mailto:jrkrideau at yahoo.ca]
> > Sent: Friday, April 20, 2007 5:11 PM
> > To: Daniel Nordlund; a.martino at crismaitalia.it;
> r-help at stat.math.ethz.ch
> > Subject: Re: [R] importing sas datasets
> > 
> > Hi Anna,
> > 
> > I'm the sas.get problem man.
> > 
> > I still have not gotten it to work but I think
> that is
> > because I have some slightly dodgy SAS files.
> > Assuming that the sas.get problem is what was
> > described in the earlier thread it appears to have
> > been fixed.  You might want to do an update to R
> to
> > get the most recent Hmisc.
> 
> I have been wrong before, I will be wrong again in
> the future, but as far as I can tell sas.get is
> still broken in the Windows version of Hmisc.  The
> work around that has been described several times
> does solve the problem.

Could well be.  I was going by the work-around
described earlier where one line of code needed to be
modified. Line 127 ?

A recent update of Hmisc appears to have this mod.
> 
> > 
> > An alternative in Hmisc that Frank Harrell pointed
> out
> > is to do a SAS export file and a special version
> of
> > the format file.
> > 
> > It is described in the Hmisc reference manual See
> > sasxport.get . It worked just fine for me on a
> couple
> > of test files. I don't remember but I think you're
> > stuck with the 8 character variable names though.
> > 
> 
> If the sasxport.get function works for your
> purposes, go for it.  But if you have access to SAS
> and have SAS datasets that you want to use in R, I
> would rather import them directly than to go to the
> extra step of creating a sas xport file and then
> importing that. 

Me too, but I had not used SAS in about 10-12 years
and all my experience is with it on mainframes so I
was willing to take whatever I could get.  The last
time I moved a large SAS dataset it was on tape and I
carried it myself. 

Except for losing the variable labels I'd much prefer
just to get it in csv. Unfortunately we have about
1800 variables with incomprehensible names. Whoever
set up the file stuck to the 8 character name
convention from the old days.



More information about the R-help mailing list