Usage
sas.get(library, member, variables, ifs,
format.library=library, id, dates.,
keep.log=TRUE, log.file="_temp_.log", macro=sas.get.macro,
data.frame.out=TRUE, clean.up=FALSE, quiet=FALSE,
temp=tempfile("SaS"), formats=TRUE, recode=formats,
special.miss=FALSE, sasprog="sas",
as.is=.5, check.unique.id=TRUE, force.single=FALSE,
where, uncompress=FALSE)is.special.miss(x, code)
x[...]
## S3 method for class 'special.miss':
print(x, ...)
## S3 method for class 'special.miss':
format(x, ...)
sas.codes(object)
code.levels(object)
Arguments
library
character string naming the directory in which the dataset is kept.
member
character string giving the second part of the two part SAS dataset name.
(The first part is irrelevant here - it is mapped to the UNIX directory name.)
x
a variable that may have been created by sas.get
with
special.miss=T
or with recode
in effect.
variables
vector of character strings naming the variables in the SAS dataset.
The S dataset will contain only those variables from the
SAS dataset.
To get all of the variables (the default), an empty string may be given.
It is a fatal error if any one of the v
ifs
a vector of character strings, each containing one SAS "subsetting if"
statement.
These will be used to extract a subset of the observations in the SAS dataset.
format.library
The UNIX directory containing the file formats.sct, which contains
the definitions of the user defined formats used in this dataset.
By default, we look for the formats in the same directory as the data.
The user defined formats must be available (
formats
Set formats
to F
to keep sas.get
from telling the SAS macro to
retrieve value label formats from format.library
. When you do not
specify formats
or recode
, sas.get
recode
This parameter defaults to TRUE
if formats
is TRUE
. If it is
TRUE
, variables that have an appropriate format (see above) are
recoded as factor
objects, which map the values
to the value lab
special.miss
For numeric variables, any missing values are stored as NA in S.
You can recover special missing values by setting special.miss
to
TRUE
. This will cause the special.miss
attribute and the
special.miss
c
id
The name of the variable to be used as the row names of the S dataset.
The id variable becomes the row.names
attribute of a data frame, but
the id variable is still retained as a variable in the data frame.
(if data.frame.out
is
dates.
specifies the format for storing SAS dates in the
resulting data frame
as.is
IF data.frame.out=T
, SAS character variables are converted to S factor
objects if as.is=F
or if as.is
is a number between 0 and 1 inclusive and
the number of unique values of the variable is less than
the number of o
check.unique.id
If id
is specified, the row names are checked for
uniqueness if check.unique.id=T
. If any are duplicated, a warning
is printed. Note that if a data frame is being created with duplicate
row names, statements such as my.da
force.single
By default, SAS numeric variables having LENGTH
s > 4 are stored as
S double precision numerics, which allow for the same precision as
a SAS LENGTH
8 variable. Set force.single=T
to store every
numeric variable in si
dates
One of the character strings "sas"
, "yearfrac"
, "yearfrac2"
, "yymmdd"
.
If a SAS variable has a date format (one of "DATE", "MMDDYY", "YYMMDD",
"DDMMYY", "YYQ", "MONYY", "JULIAN"), it will be converted to
keep.log
logical flag: if FALSE
, delete the SAS log file upon completion.
log.file
the name of the SAS log file.
macro
the name of an S object in the current search path that contains the text of
the SAS macro called by S. The S object is a character vector that
can be edited using for example sas.get.macro <- editor(sas.get.macro).
data.frame.out
logical flag: if TRUE
, the return value will be an S data frame,
otherwise it will be a list.
clean.up
logical flag: if TRUE
, remove all temporary files when finished. You
may want to keep these while debugging the SAS macro. Not needed for R.
quiet
logical flag: if FALSE
, print the contents of the SAS log file if
there has been an error.
temp
the prefix to use for the temporary files. Two characters
will be added to this, the resulting name
must fit on your file system.
sasprog
the name of the system command to invoke SAS
uncompress
set to T
to automatically invoke the UNIX gunzip
command
(if member.ssd01.gz
exists) or the uncompress
command
(if member.ssd01.Z
exists) to uncompress the SAS dataset before
proceeding. T
where
by default, a list or data frame which contains all the variables is returned.
If you specify where
, each individual variable is placed into a
separate object (whose name is the name of the variable) using the
assign
function wit
code
a special missing value code (A through Z or underscore) to check
against. If code
is omitted, is.special.miss
will return
a T
for each observation that has any special missing value.
object
a variable in a data frame created by sas.get