[R] SAS and R

Tim Churches tchur at optushome.com.au
Sat Apr 27 00:19:06 CEST 2002

Frank E Harrell Jr wrote:
> It may be worth pointing out that the new read.ssd has to launch SAS 
> to convert to xport format.  The sas.get philosophy is that if you are 
> going to have to do that you might as well ask the sas session to dump 
> the data to ASCII files, with optional restriction to a subset of the
> variables.   That way you can fetch all the SAS attributes such as variable
> labels, data/time info, etc.  -Frank

SAS Version 8.2 provides an XML "engine" which allows you to write one
or an
ensemble of SAS datasets to an XML file (with a SAS-supplied DTD). The
WHERE clause subsetting etc can be used with this engine. The XML
represents date/time values and preserves the full precision of floats
the SAS xport format which reduces the precision of numeric variables
56 bits to 53 bits). Best of all, the new SAS XML format preserves all
metadata such as dataset and variable labels, and even "formats"
lookup tables): if a format is permanently associated with a variable,
XML engine can be told to fetch the relevant format from an external
catalogue, convert it to an XML representation and enbed that in the
XML file. Hallelujah!

I haven't tried this yet, but it should be possible to use Duncan Temple
XML package to parse the SAS dataset XML files and create a
data frame complete with labelled factors etc.

Tim C
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