BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
keherder
Obsidian | Level 7

Hello! I wish to conduct a ttest comparing means of a vairable between the two groups in the class variable, but it doesn't seem to be doing that. 

 

Here is my code:

 

proc surveymeans data=fus t;
cluster group;
var interest;
class period;
run;
 
Whether I take out or leave in the class statment, I get only a single t statistic for my interest variable. I would like a t test comparing the mean in terest between my two periods (in the class statement). Any suggestions how I could do this? I would like to account for the clusters, which is why I don't want to use a regular proc ttest. Thank you!
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I don't think SURVEYMEANS compares the means of the two groups, just the same way as PROC MEANS doesn't compare the means of two groups. It produces a t-test to see if the mean is equal to zero.

 

I think to get the t-test comparing differences between two means, you would have to use the linear model version of the t-test to compare two means

 

proc surveyreg data=fus;
cluster group;
class period;
model interest=period;
run;

Of course, all of this is untested; if you want tested code, provide (a portion of) the actual data as SAS data step code.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

I don't think SURVEYMEANS compares the means of the two groups, just the same way as PROC MEANS doesn't compare the means of two groups. It produces a t-test to see if the mean is equal to zero.

 

I think to get the t-test comparing differences between two means, you would have to use the linear model version of the t-test to compare two means

 

proc surveyreg data=fus;
cluster group;
class period;
model interest=period;
run;

Of course, all of this is untested; if you want tested code, provide (a portion of) the actual data as SAS data step code.

--
Paige Miller
keherder
Obsidian | Level 7

Thanks so much, this worked perfectly!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 938 views
  • 1 like
  • 2 in conversation