BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
trungdungtran
Obsidian | Level 7

Hi all,

 

I am using both SAS and R for my tasks. For a particular task, I use SAS for data manipulation, export, then import into R, and then use R to fit a Bayesian model with package rstan. For another task, I use R for data manipulation, export, then import into SAS.

 

I have known that we can call R into SAS by using proc iml. However, I think Rstudio is also strong as we can check values quickly so for me working with R in SAS is not much advantageous as working with R in Rstudio.

 

From your experience, could you suggest in which situations should we call R into SAS with proc iml rather than working independently as I mention above?

 

Thank you for reading!

 

Kind regards,

Trung Dung.

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

While I agree with my friend @andreas_lds that there is a cost to switch contexts (more moving parts, more apps to maintain, harder to automate), I know many SAS customers that use SAS alongside other tools like Python and R -- often across different teams -- so a smooth integration process is required. 

 

This video featuring @Rick_SAS explains one big advantage: Reuse.  That is, sometimes we have colleagues that build good work in R -- and we don't want to have to re-implement in SAS to take advantage of it.

 

 

SAS Viya supports access from R into SAS.  @joeFurbee shares an example using RStudio in this blog.

SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.

View solution in original post

7 REPLIES 7
Kurt_Bremser
Super User

If you want to make full use of the SAS environment (metadata, batch processing, ...), calling R from within SAS is mandated.

Data engineering (or what's called ETL) is a pure SAS domain. R is lacking considerably with respect to that, at least it was when I last looked into it.

trungdungtran
Obsidian | Level 7
Thank you for your suggestion!
andreas_lds
Jade | Level 19

I have hardly any experience in R and i really don't mean to be rude, but i can't think of a polite way to say: any process that requires switching tools is crap and needs redesign, if the process could be implemented by using just one tool.

trungdungtran
Obsidian | Level 7
I think that both tools are developed to work independently. However, my knowledge is limited so I just use both to make my tasks easier.
ChrisHemedinger
Community Manager

While I agree with my friend @andreas_lds that there is a cost to switch contexts (more moving parts, more apps to maintain, harder to automate), I know many SAS customers that use SAS alongside other tools like Python and R -- often across different teams -- so a smooth integration process is required. 

 

This video featuring @Rick_SAS explains one big advantage: Reuse.  That is, sometimes we have colleagues that build good work in R -- and we don't want to have to re-implement in SAS to take advantage of it.

 

 

SAS Viya supports access from R into SAS.  @joeFurbee shares an example using RStudio in this blog.

SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.
Rick_SAS
SAS Super FREQ

As others have mentioned, the workflow is important. I have written about 12 advantages of using the SAS/IML interface to call R, and most involve the convenience of integrating the two programs.

 

My suggestion: First use RStudio or whatever R tools you want to develop the R portion of your analysis, using simulated data if necessary while you write the program. (Do the same for the SAS portion of your program, using your favorite SAS development tools.) After the R program is debugged and stable, integrate it into your SAS workflow. Many people try to develop the SAS and R portions of the code simultaneously, and that usually leads to problems. If you adopt a modular approach to development and debugging, the process will go smoother.

trungdungtran
Obsidian | Level 7
Thank you so much! I have implemented for a task as you have said. I did SAS and R portion independently until everything is fine then I integrate them and then I can only type in SAS and run R behind the scene.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1277 views
  • 8 likes
  • 5 in conversation