BookmarkSubscribeRSS Feed
stanmarciano
Fluorite | Level 6

Reposting this from here: https://communities.sas.com/t5/SAS-Statistical-Procedures/Anova-Analyzing-experiment-with-within-and...

 

Hi I have an experiment with one between subjects factor (Lets say FactorA) with two levels: Big and Small and one within subjects factor (FactorB - Quality) with three levels: 1, 2 and 3 - corresponding to High, Medium and Low.

 

I want to examine the effect of both the factors on the Dependent Variable measured after each of the participant was put into one of the two conditions (Big or small) and evaluate some things (High, medium and low) : Dep_Var1, Dep_Var2 and Dep_Var3.

 

I am using the following code: 

 

proc glm data = Dataset.data;
class FactorA FactorB SubjectID;
model  Dep_Var1, Dep_Var2 Dep_Var3= FactorA|FactorB /ss3;
repeated SubjectID, FactorB;

lsmeans Condition/pdiff stderr;
run;

 

However I keep on getting the following statement in the Log:

 

NOTE: The CLASS variable FactorB has only one level: '1'.
ERROR: Ambiguous level information in REPEATED statement

 

Also if I change this to the following:

 

proc glm data = Dataset.data;
class FactorA FactorB SubjectID;
model  Dep_Var1, Dep_Var2 Dep_Var3= FactorA|FactorB /ss3;
repeated SubjectID;

lsmeans Condition/pdiff stderr;
run;

 

I get the following error: 

NOTE: The CLASS variable FactorB has only one level: '1'.
NOTE: H Matrix for SubjectID*FactorB has zero d.f.


NOTE: H Matrix for SubjectID*FactorA*FactorB has zero d.f.

 

Here's a snippet of the data for easy reference:

 

SubjectID FactorA Dep_Var1 Factor_B Dep_Var2 Factor_B Dep_Var3 Factor_B
1 Big 9 1 2 2 29 3
2 Small 9 1 5 2 28 3
3 Small 12 1 2 2 27 3
4 Small 9 1 2 2 28 3
5 Big 11 1 5 2 29 3
6 Big 9 1 5 2 21 3
7 Small 9 1 2 2 26 3
8 Big 10 1 2 2 26 3
9 Big 13 1 5 2 25 3
10 Small 10 1 4 2 25 3

 

I realize that I am making a mistake in how I have input FactorB, but cannot figure out what to do here. Any help is appreciated.

 

Thanks.

1 REPLY 1
pau13rown
Lapis Lazuli | Level 10

you need to restructure the dataset so factorb is listed downwards, rather than being split into 3 separate variables. The dataset snippet cannot be right though: you can't have 3 variables with the same variable name 'factorb'

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 260 views
  • 0 likes
  • 2 in conversation