Calling Functions in the R Language


Transfer from a SAS Source to an R Destination

Table 12.1 summarizes the subroutines that copy data from a SAS source to an R destination. For more information, see the section Details of Data Transfer.

Table 12.1: Transferring from a SAS Source to an R Destination

Subroutine

SAS Source

R Destination

ExportDataSetToR

SAS data set

R data frame

ExportMatrixToR

SAS/IML matrix

R matrix


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.

proc iml;
call ExportDataSetToR("Sashelp.Class", "df" );
submit / R;
   names(df)
endsubmit;

The R names function produces the output shown in FigureĀ 12.2.

Figure 12.2: Result of Sending Data to R

[1] "Name"   "Sex"    "Age"    "Height" "Weight"