[R] Reading SAS version 8 data into R
fharrell@virginia.edu
fharrell at virginia.edu
Fri Aug 24 13:26:08 CEST 2001
What you have described is a bug in SAS that I know
was present with the first release of V8. I hope
that the bug has been fixed in the latest rendition
of V8. Otherwise, SAS long names are probably
to be avoided for now. -Frank Harrell
"BXC (Bendix Carstensen)" wrote:
>
> > -----Original Message-----
> > From: Patrick McKnight [mailto:pem at theriver.com]
> > Sent: 24. august 2001 06:59
> > To: r-help at lists.R-project.org
> > Subject: Re: [R] Reading SAS version 8 data into R
> >
> >
> > Soren,
> >
> > The following code runs just fine from SAS V.8 and imports
> > into R without
> > a hitch:
> >
> > libname xxx sasv5xpt 'yourfilenamehere';
> >
> > data xxx.dat;
> > set perm.yoursasv8data;
> > run;
>
> No it does unfortunely not.
>
> Try the following in SAS v8, and you will see exactly
> that the long variable names causes problems. Apparently there is no
> way around shortening your variable names, except writing SAS-programs
> that punches data on to flat files.
>
> Data x8 ;
> input x y a_k verylongname ;
> cards;
> 1 2 3 4
> 2 . 4 6
> 5 6 7 .
> 4 5 8 8
> ;
> Run ;
>
> * This is OK ;
> Libname zzz xport "dataset.xpt";
> Data zzz.first3 ;
> Set x8 ( keep = x y a_k ) ;
> Run ;
>
> * This will fail ;
> Libname xxx xport "longdat.xpt";
> Data xxx.all;
> Set x8 ;
> Run ;
>
> ----------------------
> Bendix Carstensen
> Senior Statistician
> Steno Diabetes Centre
> Niels Steensens Vej 2
> DK-2820 Gentofte
> Denmark
> tel: +45 44 43 87 38
> mob: +45 28 25 87 38
> fax: +45 44 43 73 13
> bxc at novo.dk
> www.biostat.ku.dk/~bxc
> ----------------------
> >
> >
> > Hope this helps.
> >
> > Cheers,
> >
> > Patrick
> >
> >
> >
> > > Date: Thu, 23 Aug 2001 23:04:05 +0200
> > > From: =?iso-8859-1?Q?S=F8ren_H=F8jsgaard?= <sorenh at mail.dk>
> > > Subject: [R] Reading SAS version 8 data into R
> >
> > > Hi,
> >
> > > SAS transport files created with the xport engine in SAS
> > can be read
> > using read.xport. However, the xport engine only works with
> > SAS version 6,
> > and consequently long variable names are not allowed...
> >
> > > Can anyone tell me how to get SAS data (ver 8) into R (easily)?
> >
> > > Thanks in advance
> >
> > > Sren Hjsgaard
> > > sorenh at agrsci.dk http://www.jbs.agrsci.dk/~sorenh
> > > -
> > --------------------------------------------------------------
> > -----------
> >
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> > -.-.-.-.-.-.-.-.-
> > 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
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> > _._._._._._._._._
> >
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
--
Frank E Harrell Jr Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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