Not applicable
Posts: 0

# Statistics help

From a sample of 1000 patients, the number who take a certain drug within 6 months BEFORE a heart attack is 400, and the number who take that drug within 6 months AFTER a heart attack is 550. What SAS test can I run to determine if the BEFORE and AFTER numbers are significantly different? Note that some patients may be in both groups. thanks.
Super Contributor
Posts: 260

## Re: Statistics help

You seem to need a proportion test. You can perform an equivalent to proportion test with PROC FREQ and chi-2 test (cross BEFORE/AFTER with GROUP).

Regards
Olivier
Not applicable
Posts: 0

## Re: Statistics help

Olivier: thanks for your reply. Can you provide more detail on the cross you mention? It seems that I have the following 2x2 table:

Group 1(Before): No (600) Yes (400)

Group 2 (After): No (450) Yes (550)
Not applicable
Posts: 0

## Re: Statistics help

Assuming that you are looking for chi-square test of independence and estimate the difference in the proportion of the two groups; here is the code-

data test;
input grp \$ n_y \$ n;
datalines;
before no 600
before yes 400
after no 450
after yes 550
;
run;

proc freq data=test;
tables grp*n_y/chisq riskdiff;
weight n;
run;

As shown in the output stat, the p-value (<.0001) suggests that the two groups (before and after) are not independent. Look into the Risk Estimates table, there is significant difference between the group proportions.

Hope this helps.
Not applicable
Posts: 0