BookmarkSubscribeRSS Feed
Emma_at_SAS
Lapis Lazuli | Level 10
I have data that shows how many days during the pandemic, kids visited their friends. Overall, the number of days boys and girls visited their friends is significantly different. How may I test to see which interval categories are different as a post-hoc test? I am interested in 4 comparisons: girls 1-10d with boys 1-10d, girls 11-20d with boys 11-20d,  girls 21-30d with boys 21-30d, and girls 31+ with boys 31+
Thanks 
 

proc surveyfreq data =&data nosummary;
tables gender*visiting_friends_dpYear/ nostd nocellpercent row row(cl) chisq;
weight weight_var;
run;

 
The SURVEYFREQ Procedure

 

 
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
1 REPLY 1
Watts
SAS Employee

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;

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1 reply
  • 747 views
  • 0 likes
  • 2 in conversation