Previous Page | Next Page

Calling Functions in the R Language

Transfer from a SAS Source to an R Destination

Table 11.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 11.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;
run ExportDataSetToR("Sashelp.Class", "df" );
submit / R;
   names(df);
endsubmit;

The R names function produces the output shown in Figure 11.2.

Figure 11.2 Result of Sending Data to R
[1] "Name"   "Sex"    "Age"    "Height" "Weight"                                

Previous Page | Next Page | Top of Page