BookmarkSubscribeRSS Feed
SAS93
Quartz | Level 8

To summarize with a hypothetical situation:

 

I'm using proc surveymeans to get the means of a variable: average number of trips to the grocery store, using a domain that has 2-3 levels (2 different domains). 

 

I'm looking to compare the means within each domain level to one another (like a t-test) to see if they are in fact significantly different (the 95% CIs overlap just slightly, so I can't use that as a proxy). 

 

What's the best way to do this? 

 

I'm working with Version 9.4, level 1M3, so (as far as I know) the diffmeans statement doesn't work. 

5 REPLIES 5
SAS_Rob
SAS Employee

If you are using an older release then you can use Proc SURVEYREG instead, using the approach in the example in the usage note linked below.

https://support.sas.com/kb/34/607.html

dbcrow
Obsidian | Level 7

Hi-

 

I'm facing the same problem myself and the solution I discovered is to use the "riskdiff" option in the "tables" statement of PROC SURVEYFREQ. 

 

Here's an example:  

proc surveyfreq data=temp varmethod=jackknife;
weight w0;
repweight w1-w120;
tables year*(var1 var2 var3) / row riskdiff (col=2);
run;

The output will give you the row percentage for the first category of "year", the row percentage for the second category of "year", the difference between the two row percentages, and a confidence interval around the difference. If the confidence interval excludes 0, then the difference is statistically significant at alpha = .05. 

 

If you want, say, 90% confidence intervals, you can adjust this with "CL" option and "ALPHA" sub-option. 

 

There are some rather serious limitations, however. First you can only get risk differences for a 2 x 2 table, which means that tables of higher dimensions have to be broken down into 2 x 2 subtables. Second, "riskdiff" only gives a confidence interval around the difference between the risks, and not the p-value, which would sometimes be helpful to know. 

 

Does anyone know a SAS trick for doing t-tests with complex survey data on tables that are more than 2 x 2? 

ballardw
Super User

One or more DOMAIN variables and you can compare the means, plus confidence limits of the means, for any practical number of groups and likely cleaner than with the riskdiff.

Year in your example would be a Domain variable.

dbcrow
Obsidian | Level 7

Many thanks. Using a "DOMAIN" statement with PROC SURVEYMEANS was definitely a better way to do this! 

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
  • 5 replies
  • 1380 views
  • 2 likes
  • 5 in conversation