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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7428 views
  • 0 likes
  • 4 in conversation