Hi,
Does anyone know how to test for trends when your data needs to account for a complex survey design?
For example, I am using NIS data by HCUP and they require that proc SURVEYFREQ be used to analyze any frequencies. However, there is no option to test for a cochran-armitage test in that procedure like there is in proc FREQ. I see a lot of papers online that I think just use proc freq with complex data, however, I think that is incorrect because that does not take into account the survey design of the samples. Any help would be appreciated.
Thanks
@knicks1189 wrote:Hi,
Does anyone know how to test for trends when your data needs to account for a complex survey design?
For example, I am using NIS data by HCUP and they require that proc SURVEYFREQ be used to analyze any frequencies. However, there is no option to test for a cochran-armitage test in that procedure like there is in proc FREQ. I see a lot of papers online that I think just use proc freq with complex data, however, I think that is incorrect because that does not take into account the survey design of the samples. Any help would be appreciated.
Thanks
(You can't do this with SURVEYFREQ afaik. You can use SURVEYFREQ to generate your estimates. For trend tests you might be able to use SURVEYREG; it depends on the type of estimates for which you are testing trend. If means and proportions then read on. If something more complex, then I think you are out of luck.)
What you need is the ability to specifiy a contrast of the estimates using the coefficients of orthogonoal polynomials corresponding to the level of the contrast (linear, quadratic, cubic, etc.)
Unfortunately, SURVEYFREQ and SURVEYMEANS do not have a contrast statement though SURVEYREG does.
If you can generate your estimates as the beta coefficients to a linear regression model, you can test for trend (linear, quadratc, cubic, etc.) with SURVEYREG.
Suppose, for example, you are calculating the means of several groups and want to determine if there is a linear trend across the group means; this assumes an ordering of the groups in order to conceptualize the notion of trend.
Anyway, you can create the group means with SURVEYMEANS and SURVEYREG.
Key SURVEYREG code would look like this:
class groups;
model y=groups / noint;
Assuming group has 4 levels with values 1-4 and you want to test for linear trend from 1 to 4 of the group means, you'd use the following contrast statement:
contrast groups -3 -1 1 3;
This SAS note shows you how to generate orthogonal contrast coefficents that depend on the number of levels of your variable and the type of contrast you want to test:
http://support.sas.com/kb/22/912.html
I think if you are wanting to test trend for estimates of percents or means that this approach will work for you.
Good Luck!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.