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!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 288 views
  • 1 like
  • 2 in conversation