New Contributor
Posts: 4

# how to do a one-way anova with multiple categorical variables

Hi I'm trying to use SAS Studio 3.5 to find which variables affect another variable in a dataset. I know you can use 1 way ANOVA to see if 1 factor affects another variable, but how do you select more than one categorical variable? SAS Studio only lets you select one categorical variable.

SAS Super FREQ
Posts: 4,249

## Re: how to do a one-way anova with multiple categorical variables

By definition, a "one-way" analysis uses one categorical variable to divide the data into multiple groups.  Are you trying to compare the joint frequencies or check the association between of multiple variables? The name of the SAS Studio task for that is "N-way analysis."

New Contributor
Posts: 4

## Re: how to do a one-way anova with multiple categorical variables

Thanks, I too thought N-way ANOVA to be the correct process, but the solution of the project I'm working on tells me to use one way anova, so it confused me a bit. I've attached the solution that my course has provided (Question 3 is the one I'm working on).

Also, what are the steps to test the effect of multiple variables on another variable in N-way ANOVA then?

SAS Super FREQ
Posts: 4,249

## Re: how to do a one-way anova with multiple categorical variables

If you have questions about a specific exercise, I suggest that you ask your instructor or online support team.

Super User
Posts: 10,788

## Re: how to do a one-way anova with multiple categorical variables

```If you want do ANOVA, proc glm is best choice:

proc glm data=have;
class a b c;
model y= a b c /solution;
run;

```
New Contributor
Posts: 4

## Re: how to do a one-way anova with multiple categorical variables

what do you mean by a, b, and c? and what does "/solution" mean?

SAS Super FREQ
Posts: 4,249

## Re: how to do a one-way anova with multiple categorical variables

A SAS Studio task generates SAS code, usually in the form of a call to a SAS procedure.  If you click on the Code tab, you can see the program.  In this case, the call is to PROC GLM.  The SOLUTION option that KSharp mentions is an option in that procedure.

You have probably already read the documentation for the N-Way ANOVA task. As you click various buttons in the task, you will see the code change. You can use the doc for the underlying procedure to understand the procedure better, and to invoke options that are not supported by the procedure.

After you identify the name of the procedure that is being run,

1. Go to the SAS/STAT User's Guide documentation.

2. In the Contents  tab, click Procedures to expand the reference for procedure.

3. Scroll down and click on the doc for the relevant procedure.

In this way you can learn the SAS programming language and discover the meaning of various options/syntax.

New Contributor
Posts: 4

## Re: how to do a one-way anova with multiple categorical variables

Thanks. I've tried to do this but because my dataset is so large it takes forever for the process to run (I've been waiting for over half an hour, and since I'm using VMWare to access it, it loses connection after some time), given that I have so many variables. Is there a quicker way to do this?

Discussion stats
• 7 replies
• 1179 views
• 0 likes
• 3 in conversation