Read and Write 'SAS' 'XPORT' Files
Functions for reading, listing
the contents of, and writing 'SAS' 'xport' format files.
The functions support reading and writing of either
individual data frames or sets of data frames. Further,
a mechanism has been provided for customizing how
variables of different data types are stored.
SASxport - Read and Write SAS XPORT Files
This package provides functions for reading, listing the contents of, and writing SAS xport format files. The functions support reading and writing of either individual data frames or sets of data frames. Further, a mechanism has been provided for customizing how variables of different data types are stored.
Writing SAS XPORT files
write.xport writes one or more data frames into a SAS XPORT format
The function creates a SAS XPORT data file (see reference) from one or more data frames. This file format imposes a number of constraints:
- Data set and variable names are truncated to 8 characters and converted to upper case. All characters outside of the set A-Z, 0-9, and '_' are converted to '_'.
- Character variables are stored as characters.
autogen.formats = TRUE(the default), factor variables are stored as numeric with an appropriate SAS format specification. If
autogen.formats = FALSE, factor variables are stored as characters.
- All numeric variables are stored as double-precision floating point values utilizing the IBM mainframe double precision floating point format (see the reference).
- Date and time variables are either converted to number of days since 1960-01-01 (date only), or number of seconds since 1960-01-01:00:00:00 GMT (date-time variables).
- Missing values are converted to the standard SAS missing
The SAS XPORT format allows each dataset to have a label and a
type (set via the
SAStype functions). In addition,
each variable may have a corresponding label, display format, and
input format. To set these values, add the attribute
SASiformat to individual data frame. These
attributes may be set using the
SASiformat functions. (See examples in the package.)
The actual translation of R objects to objects appropriate for SAS
is handled by the
toSAS generic and associated methods, which
can be (re)defined by the user to provide fine-grained control.
Reading SAS XPORT files
read.xport reads a file as a SAS XPORT format library and returns a list
of data frames:
- SAS date, time, and date/time variables are converted
Date, POSIX, or
- SAS labels are stored in
labelattributes on each variable, and are accessible using the
- SAS formats are stored in
SASformatattributes on each variable, and are accessable using
- SAS iformats are stored in
SASiformatattributes on each variable, and are accessable using
- SAS integer variables are stored as integers unless
If the file includes the output of
PROC FORMAT CNTLOUT=,
variables having customized label formats will be converted to
factor objects with appropriate labels.
If a datasets in the original file has a label or type, these will
be stored in the corresponding
which can be accessed by the
GPL 2.1 © Gregory R. Warnes, United States Government, Frank E. Harrell, Jr., Douglas M. Bates, Mango Solutions
Functions in SASxport
|reexports||Objects exported from other packages|
|toSAS.default||Convert R Data Object for Storage in a SAS XPORT File|
|makeSASNames||Create valid and unique SAS names from a character vector.|
|read.xport||Import a SAS XPORT File|
|write.xport||Write Data to a SAS XPORT File|
|SASxport-package||Read and Write SAS Export Files|
|lookup.xport||Describe the Contents of an SAS XPORT File|
|Alfalfa||Example SAS data set|
|SASformat||Set or Retreive the 'label', 'SASformat', 'SASiformat', or 'SAStype' attribute of a vector or (components of) a data frame|
Last month downloads
|Packaged||2018-02-26 15:59:52 UTC; gwarnes|
|Date/Publication||2018-02-26 17:40:03 UTC|
Include our badge in your README