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.
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.
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.
The 2025 SAS Hackathon has begun!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.