BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
4 REPLIES 4
Olivier
Pyrite | Level 9
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
deleted_user
Not applicable
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)
deleted_user
Not applicable
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.
deleted_user
Not applicable
You have paired data: 1000 observations of the form NN, NY, YN, YY. As such you might wish to apply McNemar's test, which is part of the output from the AGREE option in Proc Freq.

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!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 4 replies
  • 1160 views
  • 0 likes
  • 2 in conversation