Language Reference

IMPORTTABLEFROMR Function

IMPORTTABLEFROMR (RExpr) ;

This function is supported only by the IML procedure.

You can use the IMPORTTABLEFROMR function to transfer data from an R data frame to a SAS/IML table. It is easier to read the function name when it is written in mixed case: ImportTableFromR.

The argument for the function follows:

RExpr

is a literal string or a character matrix that specifies the name of an R data frame or, in general, an R expression that can be coerced to an R data frame.

The following statements create a data frame in R named RData and copy the data into the SAS/IML table named tbl.

proc iml;
submit / R;
z = c('a','b','c','d','e')
RData <- data.frame(x=1:5, y=(1:5)^2, z=z)
endsubmit;

tbl = ImportTableFromR("RData");
call TablePrint(tbl);

Figure 192: Contents of a SAS Data Set Created from R Data

tbl
ObsXYZ
111a
224b
339c
4416d
5525e


For more information about transferring data between R data frames and SAS/IML tables, see the ImportDataSetFromR subroutine.

Last updated: May 07, 2026