BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hi All,

I have a ' day' variable and it is divided in 'Morning' , 'Noon' and 'Evening'. I have also the 'TimeSpent' in each of these parts. I want to test if there is any statistical difference in the mean time spent in each of the three parts of the 'day'. When I use:-

proc ttest data=data;
class day;
var TimeSpent;
run;

Error:-

The CLASS variable has more than two levels.

Kindly guide how to deal with this.

Kind Regards,
Kritanjli
1 ACCEPTED SOLUTION

Accepted Solutions
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
Actually, it should be:
proc glm data=data;
class day;
model TimeSpent = day;
lsmeans day / pdiff;
run;

Note: you may have clustering with your data, if you are recording/measuring the same individuals at each of these times (a type of repeated measures). That is, with three values per subject (I call it id here). Would have to know more information, but you could handle in a simple way, if
proc mixed data=data;
class id day;
model TimeSpent = day;
random id;
lsmeans day / pdiff;
run;

View solution in original post

3 REPLIES 3
mfisher
Fluorite | Level 6
proc glm data=data;
class day;
var TimeSpent;
run;
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
Actually, it should be:
proc glm data=data;
class day;
model TimeSpent = day;
lsmeans day / pdiff;
run;

Note: you may have clustering with your data, if you are recording/measuring the same individuals at each of these times (a type of repeated measures). That is, with three values per subject (I call it id here). Would have to know more information, but you could handle in a simple way, if
proc mixed data=data;
class id day;
model TimeSpent = day;
random id;
lsmeans day / pdiff;
run;
Ksharp
Super User
Just as mfisher said.
Use ' proc glm' + ' means /schette ' statement. '/schette' is what i forgot.


Ksharp

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!

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
  • 3 replies
  • 7348 views
  • 0 likes
  • 4 in conversation