Adrian Dusa wrote:
Dear Frank,
I understand. Never used SAS before, so I don't have it installed anywhere.
StatTransfer is a very useful tool indeed, but maybe I don't know how to
use it properly.
What I have is a "mydata.sas7bdat" file, along with a "formats.sas7bcat"
file.
I specified reading SAS value labels "Read directly from a catalog
file", but nothing appears in the output, neither in the R workspace nor
in an intermediate SPSS file.
I also tried exporting to a SAS portable file to import directly in R,
but there is probably something obvious that I miss because value labels
are not there, whatever I do...
Thanks for your help,
Adrian
Stat/Transfer has a menu option to read the SAS format catalog but I
haven't tried it.
Frank
On Saturday 31 January 2009, Frank E Harrell Jr wrote:
> Adrian Dusa wrote:
> > Dear all,
> >
> > I am trying to import a SAS file into R (in fact I only need the value
> > labels from the formats file), using Hmisc package, but I get this
error:
> >
> > my.sas <- sas.get("/home/adi/3", "fis1_sgg")
> > sh: sas: not found
> > Error in sas.get("/home/adi/3", "fis1_sgg") :
> > SAS job failed with status 32512
> >
> > I read some past discussions and I get the impression that sas.get()
> > needs the full path to the SAS executable, but I don't have that
because
> > I am using Linux.
> >
> > Is it possible to use sas.get() without having SAS installed?
>
> Since sas.get is trying to execute sas the answer is a definite no
> unless you use the sas.get option to run SAS on another machine to
> produce the input ASCII files needed by sas.get. Also investigate
> sasxport.get if you have SAS version 5 transport files to import.
> See also http://biostat.mc.vanderbilt.edu/SASexportHowto
>
> As SAS never got it right in allowing for full metadata to be included
> in a SAS dataset, you often have to run PROC FORMAT CNTLOUT=... to
> convert format libraries to SAS datasets so that programs such as
> sasxport.get can assign value labels [if you have SAS installed, sas.get
> runs PROC CONTENTS for you.]. SPSS and Stata have always been ahead of
> SAS in this regard.
>
> Note that the excellent Stat/Transfer commercial product will convert
> from almost any SAS dataset format to compact R binary objects,
> including variable labels the way the Hmisc package handles them. If
> you have another way to convert from SAS to Stata or SPSS, R is great at
> readying those formats.
>
> Frank
>
> > Or alternatively, is there another function to import the formats
into R?
> >
> > Thanks in advance for any hint,
> > Adrian
--
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd.
050025 Bucharest sector 5
Romania
Tel.:+40 21 3126618 \
+40 21 3120210 / int.101
Fax: +40 21 3158391
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
______________________________________________
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.