Programming the statistical procedures from SAS

Dealing with CLASS with more than 2 variables

Reply
N/A
Posts: 0

Dealing with CLASS with more than 2 variables

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
Contributor
Posts: 58

Re: Dealing with CLASS with more than 2 variables

proc glm data=data;
class day;
var TimeSpent;
run;
Valued Guide
Valued Guide
Posts: 679

Re: Dealing with CLASS with more than 2 variables

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;
Grand Advisor
Posts: 9,452

Re: Dealing with CLASS with more than 2 variables

Just as mfisher said.
Use ' proc glm' + ' means /schette ' statement. '/schette' is what i forgot.


Ksharp
Ask a Question
Discussion stats
  • 3 replies
  • 3164 views
  • 0 likes
  • 4 in conversation