%PROC_R: A SAS Macro that Enables Native R Programming in the Base SAS Environment

Xin Wei

Main Article Content

Abstract

In this paper, we describe %PROC_R, a SAS macro that enables native R language to be embedded in and executed along with a SAS program in the base SAS environment under Windows OS. This macro executes a user-defined R code in batch mode by calling the unnamed pipe method within base SAS. The R textual and graphical output can be routed to the SAS output window and result viewer, respectively. Also, this macro automatically converts data between SAS datasets and R data frames such that the data and results from each statistical environment can be utilized by the other environment. The objective of this work is to leverage the strength of the R programming language within the SAS environment in a systematic manner. Moreover, this macro helps statistical programmers to learn a new statistical language while staying in a familiar environment.

Article Details

Article Sidebar