proc surveyfreq data =&data nosummary;
tables gender*visiting_friends_dpYear/ nostd nocellpercent row row(cl) chisq;
weight weight_var;
run;
Gender | visiting_friends_dpYear | Frequency | Weighted Frequency |
Row Percent |
95% Confidence Limits for Row Percent |
|||
---|---|---|---|---|---|---|---|---|
Girls | 1-10 | 474 | 417.9 | 33.4 | 30.0 | 36.8 | ||
11-20 | 239 | 210.0 | 16.8 | 14.1 | 19.5 | |||
21-30 | 201 | 198.7 | 15.9 | 13.2 | 18.5 | |||
31+ | 411 | 423.9 | 33.9 | 30.3 | 37.5 | |||
Total | 1325 | 1250.5 | 100.0 | |||||
Boys | 1-10 | 291 | 349.3 | 23.0 | 19.9 | 26.1 | ||
11-20 | 248 | 354.9 | 23.4 | 20.1 | 26.6 | |||
21-30 | 213 | 347.1 | 22.9 | 19.4 | 26.4 | |||
31+ | 336 | 465.9 | 30.7 | 26.9 | 34.5 | |||
Total | 1088 | 1517.1 | 100.0 | |||||
Total | 1-10 | 765 | 767.1 | |||||
11-20 | 487 | 564.9 | ||||||
21-30 | 414 | 545.7 | ||||||
31+ | 747 | 889.8 | ||||||
Total | 2413 | 2767.6 | ||||||
Rao-Scott Chi-Square Test | |
---|---|
Pearson Chi-Square | 52.7567 |
Design Correction | 1.7674 |
Rao-Scott Chi-Square | 29.8491 |
DF | 3 |
Pr > ChiSq | <.0001 |
F Value | 9.9497 |
Num DF | 3 |
Den DF | 7236 |
Pr > F | <.0001 |
Sample Size = 2413 |
One possible approach is to construct the table as visiting_friends_dpYear * gender and use the DOMAIN=ROW option in PROC SURVEYFREQ to produce domain analysis (of gender) for each level of visiting_friends_dpYear. When you specify DOMAIN=ROW, the CHISQ option produces a one-way chi-square test for each level of the row variable (which compares 'girls 1-10d' with 'boys 1-10d' and so on).
proc surveyfreq data =&data nosummary;
tables visiting_friends_dpYear * gender / domain=row chisq;
weight weight_var;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.