BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

Using SAS 9.4

 

I am running a post-hoc power analysis (I understand it is not a great method but it is a request so I have to complete it). I have 2 groups with a total n=62 (group 1 n=49, group 2 n=13). With an alpha of 0.05 and the power set to 0.8, I want to find out what n would be needed in group 2 to show significance between the groups. I found the code below in the SAS help center but I am not sure my setup is correct. Specifically, I am not sure if I have the group proportions correct. Any help would be appreciated. Thank you

 

proc power;
twosamplefreq test=fisher
groupproportions= (.79 .21)
alpha= .05
npergroup=.
power= .8;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

proc power provides a calculation of the power of the exact binomial test for the proportion of events in a single sample. To calculate the power of detecting a difference in the number of events and non-events within a sample of size 62, when the event probability is 0.21 (= 13/62), you can do:

 

proc power;
onesamplefreq 
    test = exact
    ntotal = 62
    nullproportion = 0.5
    alpha = 0.05
    proportion = 0.21  /* = 13 / 62 */
    power = .;
run;
PG

View solution in original post

7 REPLIES 7
PGStats
Opal | Level 21

The groupproportions= option should specify the proportions of events in both groups, NOT the proportions of the group sizes to the total size. For a post-hoc analysis you would most likely write the observed proportions as the group proportions. If for example you observed 31/49 events in group 1 and 6/13 events in group 2, you would write groupproportions=0.63 0.46

 

Note that you cannot keep one of the group sizes fixed and ask for the size of the other group in proc power. One way to do it anyway is to ask for the power and adjust iteratively the size of the second group until you get the power that you want

 

proc power;
twosamplefreq test=fisher
groupproportions= (.63 .46)
alpha= .05
groupns= (49, 13) /* <- adjust the size of group 2 until calculated power = 0.8 */
power= .;
run;

 

hth

PG
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

My groups are the event, the 49 is no for the event and 13 is yes for the event. That is why I took it out of the 62. Is this not correct?

PGStats
Opal | Level 21

So, you have a proportion of 49/62 events in your (single) sample. So you must be looking for the power of a one sample frequency test?

PG
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7
Between the 2 groups that I have (1 vs 2) I want to say I need x number to achieve significance. So group 1 has 49 and group 2 has 13 so how many in group 2 are needed to show significance.
PGStats
Opal | Level 21

Significance of what? That group 1 is greater than group 2? Or what?

PG
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7
Yes, significant difference between the 2 groups
PGStats
Opal | Level 21

proc power provides a calculation of the power of the exact binomial test for the proportion of events in a single sample. To calculate the power of detecting a difference in the number of events and non-events within a sample of size 62, when the event probability is 0.21 (= 13/62), you can do:

 

proc power;
onesamplefreq 
    test = exact
    ntotal = 62
    nullproportion = 0.5
    alpha = 0.05
    proportion = 0.21  /* = 13 / 62 */
    power = .;
run;
PG

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1018 views
  • 0 likes
  • 2 in conversation