BookmarkSubscribeRSS Feed
jignesh19872
Calcite | Level 5

Hi Team,

 

I have been using SAS Viya Since past 1 year.  I want to run multivariate analysis model/Multivariate linear regression for multiple target variables in SAS.

But SAS Viya/ SAS Studio supports only one dependent/target variable. so it can not be done in SAS.

Now, I am exploring options in R language.  How can I run Multivariate model using R in SAS enviorment.

 

 

So, please guide us on belows problems

 

1) Can R Model run in SAS enviorment ?

2) Does SAS Enviorment support Multivariate model using R in SAS ? 

 

 Please give codes, links or files so I can do further research on that.

 

 

Thanks

Jingesh

9 REPLIES 9
ed_sas_member
Meteorite | Level 14

Hi @jignesh19872 

You can use R with the SAS Viya platform.

You will find more information in the following documentation: Getting Started with SAS® Viya® 3.4 for R

and also in the following blog post: https://blogs.sas.com/content/sgf/2018/07/25/using-rstudio-with-sas-viya/

 

There is also an e-book edited by SAS: SAS Viya: The R Perspective.

Hope this helps!

 

Best,

PaigeMiller
Diamond | Level 26

I'd be interested in seeing an answer as well. I think this question about multiple response variables in Viya was asked a few months ago and I don't recall seeing an answer. 

 

In case you don't know, other SAS products, such as Base SAS and SAS Studio (which comes with Viya) can handle multiple response variables, so you should be able to run multiple response variables in the modelling PROCs there, so you don't have to use R, but of course you then have to write your own code. I believe that Enterprise Guide and Enterprise Miner also allow multiple response variables. Also, another SAS product called JMP handles multiple response variables very well, and has an "optimizer" so if your goal is (for example) to minimize the value of Y1 and maximize the value of Y2 and get Y3 as close to 100 as possible, JMP will do this.

--
Paige Miller
SteveDenham
Jade | Level 19

I am stepping out of my depth here, as I don't know what PROCs are supported in Viya.  However, my quick overview of the documentation makes me think that there is no equivalent of PROC GLM (multivariate regression) or any of the multivariate.procedures.  SAS Studio is really just an interface, and could be used with UE or SAS/STAT, but unless you have those installed, your best bet is the Viya interface to open source languages.  And at that point, all I can say is read the manual and look for examples.  Or use Mr. Google for examples.  If indeed you go to R for the multivariate analysis, make sure you understand the package you select for the analysis, read all the vignettes for the package, and run toy examples until you are confident you can use it for your own data.

 

SteveDenham 

Rick_SAS
SAS Super FREQ

In terms of accessing data directly in a CAS table, the glm action supports multiple response variales. See the depvars parameter. For generalized linear models, the genmod action supports multiple dependent variables.

 

Regarding fitting a model in R, maybe I don't understand your question (or your license), but most people who have SAS Viya also have access to traditional SAS/STAT procedures such as PROC GLM and PROC GENMOD. These procedures analyze SAS data sets (not CAS tables) so you'd have to pull down the data from a CAS table (if that is where it lives) to a SAS data set.  But if you are planning to use R, you'd have to pull down the data to R anyway, so there is no advantage to using R in terms of data movement.

PaigeMiller
Diamond | Level 26

Seems to me like a major flaw/omission in a modeling platform like Viya to not allow multiple response variables.

--
Paige Miller
Rick_SAS
SAS Super FREQ

As I said, the documentation for several actions indicates that they support multiple response variables. I'm trying to understand why the OP thinks it is not possible.

PaigeMiller
Diamond | Level 26

Why? I can't speak for the OP, but I can speak for myself. I have seen at least 3 different presentations on Viya, all of which modeled a single response, and I even asked the speaker after one presentation about the capability in Viya to model multiple response variables, and I was informed that Viya doesn't do that.

 
--
Paige Miller
Rick_SAS
SAS Super FREQ

You are correct. I was wrong, and I apologize for the confusion. I just tried using the glm and genmod action with multiple response variables and got the following error:

   ERROR: The specification of multiple dependent variables is not valid in this action.

I should have tried it out before I claimed it was possible.

PaigeMiller
Diamond | Level 26

Well, certainly the documentation you linked to is confusing, the option is named depVars (plural) indicating that there could be more than one dependent variable; and then there's the part I have highlighted in red

 

depVars={{

name="variable-name"

}, {...}},

 

which would seem to indicate multiple dependent variables are allowed as well, unless that is supposed to indicate options and not another dependent variable. Little things (like making a variable name plural) can be important, and documentation is tough to get every last detail correct.

--
Paige Miller

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!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 920 views
  • 2 likes
  • 5 in conversation