sas.fget(base.name, var.file=paste(base.name,".1",sep=""), data.file=paste(base.name,".2",sep=""), id=<<see below>>, data.frame.out=T)
var.file
and
data.file
arguments.
data.frame.out
is
FALSE
, this will be the attribute
"id"
of the S-PLUS dataset).
If missing, the rows will be labeled by the counting numbers.
TRUE
, the output will be a data frame; if
FALSE
, a list.
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.
If S-PLUS and SAS can be run on the same computer, the
sas.get
function is a simpler way to import SAS data into S-PLUS.
Before using
sas.fget
you must copy the SAS macro stored in
$SHOME/cmd/sas_get to the computer running SAS.
If you are not familiar with running SAS macros,
refer to the SAS documentation.
Add three lines to the end of the copied macro: one line defines
libnames for libraries containing data, one line defines
the formats used in the data, and the third line calls the
sas.get macro. For example,
if your SAS object foo is stored in library SAS.data,
formats are in the library SAS.formats, and you call your
temporary files (to be read by
sas.fget
) file.1 and file.2,
then the three lines to add are:
libname temp
SAS.data
;
libname library
SAS.formats
;
%sas_get(temp.foo, file.1, file.2, dates=sas, vars=, ifs=);
Once you have created the two files, copy them to the machine
running S-PLUS.
These are binary files, so be sure to copy them with a utility
that leaves all the bits intact.
Finally, in S-PLUS, execute
x <- sas.fget("file")
to read
the SAS data stored in the variable description file file.1
and the data file file.2.
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 O
perating 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.
The Getting Data Into and Out of S-PLUS chapter of the S-PLUS
User's Manual.