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.
Please look at this example: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...
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.
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?
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.
Many thanks. Using a "DOMAIN" statement with PROC SURVEYMEANS was definitely a better way to do this!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.