You may choose to extract only a subset of variables
or a subset of observations in the SAS dataset.
Note: This function is deprecated. For more information, see
.
sas.get(library, member, variables=<<see below>>, ifs=<<see below>>, format.library=library, id=<<see below>>, dates="sas", keep.log=T, log.file="_temp_.log", macro="sas_get", macro.dir=<<see below>>, data.frame.out=T, clean.up=T, quiet=F, temp=tempfile("SaS"))
sas.contents
to get
the variables in the SAS dataset.
sas.get
.
data.frame.out
is
FALSE
, this will be the attribute
"id"
of the S-PLUS
dataset.)
By default, all variables are left in.
"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 the format
specified by
dates
before being given to S-PLUS.
"sas"
gives
days from 1/1/1960,
"yearfrac"
gives days from 1/1/1900 divided by
365.25,
"yearfrac2"
gives year plus fraction of current year,
and
"yymmdd"
gives a 6 digit number YYMMDD (year%%100, month, day).
Note that S-PLUS will store these as double precision numbers, not as
character strings.
FALSE
, delete the SAS log file upon completion.
TRUE
, the return value will be a S-PLUS data frame,
otherwise it will be a list.
TRUE
, remove all temporary files when finished. You
may want to keep these while debugging the SAS macro.
FALSE
, show the contents of the SAS log file if
there has been an error. The log file is displayed under control
of the program named in S-PLUS option pager.
data.frame.out
is
TRUE
, the output will
be a data frame resembling the SAS dataset. If
id
was specified, that column of the data frame will be removed and used
as the row names of the data frame.
data.frame.out
is
FALSE
, the output will
be a list of vectors, each containing a variable from the SAS
dataset. If
id
was specified, that element of the list will
be used as the
id
attribute of the entire list.
quiet
is
FALSE
, then the SAS log file will be
displayed under the control of the program named in S-PLUS option pager.
You must be able to run SAS (by typing sas from the Bourne shell)
on your system.
If the S-PLUS command
unix("sas", out=F)
does not start SAS,
then this function cannot work.
In particular, sas should not be a csh alias: the directory containing
the sas command should be in your PATH environmental variable.
The references cited below explain the structure of SAS datasets and how they are stored under UNIX. See SAS\u\s-1\(rg\s+1\d Language for a discussion of the "subsetting if" statement.
SAS Institute Inc. (1990).
SAS\u\s-1\(rg\s+1\d Language: Reference, Version 6.
First Edition.
SAS Institute Inc., Cary, North Carolina.
SAS Institute Inc. (1988).
SAS\u\s-1\(rg\s+1\d Technical Report P-176,
Using the SAS\u\s-1\(rg\s+1\d System, Release 6.03, under UNIX\u\s-1\(rg\s+1\d Operating Systems and Derivatives.
SAS Institute Inc., Cary, North Carolina.
SAS Institute Inc. (1985).
SAS\u\s-1\(rg\s+1\d Introductory Guide.
Third Edition.
SAS Institute Inc., Cary, North Carolina.
sas.contents("saslib", "mice") [1] "dose " "ld50 " "strain" "lab_no" attr(, "n"): [1] 117 mice <- sas.get("saslib", mem="mice", var=c("dose", "strain", "ld50")) plot(mice$dose, mice$ld50) nude.mice <- sas.get(lib=unix("echo $HOME/saslib"), mem="mice", ifs="if strain='nude'") nude.mice.dl <- sas.get(lib=unix("echo $HOME/saslib"), mem="mice", var=c("dose", "ld50"), ifs="if strain='nude'")