The following table summarizes the frequently used methods that copy from a SAS source to an R destination. Several of these modules and methods are used in the program in the next section. For details of the transfer process and a full list of methods that transfer data, see the "Accessing R" chapter in the online Help.
Table 11.1: Transferring from a SAS Source to an R Destination
|
Method or Module |
SAS Source |
R Destination |
|---|---|---|
|
ExportDataSetToR |
SAS data set |
R data frame |
|
ExportMatrixToR |
SAS/IML matrix |
R matrix |
|
DataObject.ExportToR |
DataObject |
R data frame |
As a simple example, the following program transfers a data set from the Sashelp libref into an R data frame named df. The program then submits an R statement that displays the names of the variables in the data frame.
run ExportDataSetToR("Sashelp.Class", "df" );
submit / R;
names(df);
endsubmit;
The R names function produces the output shown in FigureĀ 11.2.