Help using Base SAS procedures

chi-square test for proportions that overlap

Reply
Contributor lei
Contributor
Posts: 37

chi-square test for proportions that overlap

Hi I have a project that aims to assess the percentage of screened patients within a county versus the average within the whole state. Due to overlap between the state average and county proportion, I have to test whether the county is different from the rest of the state. Therefore, I will have to calculate the proportion within the county and then calculate the proportion of screened within the state removing the county that I am comparing. For example, if state is made up of 20 counties. If I want to compare county 1 to the rest fo the state, I would have to calculate the state proportion without county 1. 

 

I am wondering if there's a way to do this in SAS easily? 

 

Thanks.

 

 

Super User
Posts: 10,514

Re: chi-square test for proportions that overlap

[ Edited ]

Possibly easiest, as it doesn't require making lots of variables, would be to provide a custome format that assigns all of the county values except the one of interest to a "rest of state" vs the one you have. Use of the Keyword _other_ makes this relatively easy.

 

An example with numeric county codes:

proc format;

value Countygroup;

23="County Name"

_other_ = 'Rest of state'

;

run;

 

And assign that format to the county in your code.

If you have names or text categories then $countygroup for name and values like '23' or the county name on the left of =.

 

WARNING: if your county code is missing for any records they will be included in the "rest of state" group. If this isn't the desired behavior then you would need a separate format value or use a dataset option to drop those records.

Contributor lei
Contributor
Posts: 37

Re: chi-square test for proportions that overlap

Hi thank you so much. I have a quick question though. If I do this for all 20 counties, is this considered multiple comparison testing? For example, should I calculate the p-values and then use proc multtest to apply Bonferroni's correction? 

 

Thanks.

 

 

Respected Advisor
Posts: 2,655

Re: chi-square test for proportions that overlap

I think this is a clear case where an adjustment for multiple comparisons is needed, especially if you are going to examine differences between two states (say Texas and Wyoming, for example).  The number of counties is greatly different, and so to get comparisons on an equal basis, some sort of adjustment is needed.

 

I wouldn't go Bonferroni, though, as it is generally too conservative. Check out the alternatives in PROC MULTTEST for analysis of raw p values.

 

Steve Denham

Ask a Question
Discussion stats
  • 3 replies
  • 238 views
  • 0 likes
  • 3 in conversation