- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data MSM2017; input Alerts $ MSM $ Counts; Datalines; No Yes 20 No No 240 Yes Yes 3 Yes No 3 ; proc freq data=MSM2017; tables MSM*Alerts/RELRISK; WEIGHT COUNTS ; RUN;
Hi i would like to know what is wrong with the code i have above. There are 3 patients that are MSM and they are Alert, and there are 20 patients that are MSM but they are not alert. There are 3 patients that are Alerts but they are not MSM, and there are 240 patients that are not MSM and Not Alert.
I would like to know what is risk of being MSM to become an Alert. Is MSM at higher risk of becoming an alert patient?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Dhana18,
@Dhana18 wrote:
My colleague got RR of 10.57 using excel
That value is correct and you'll obtain it also with SAS (for "Column 2," i.e., Alerts='Yes') if you switch the rows of the 2x2 table, i.e., have MSM='Yes' as the first row, so that the relative risk is the risk ratio of MSM='Yes' vs. MSM='No' and not vice versa (which is what you currently get: 0.09465... = 1/10.5652...). One way to achieve this is to sort the dataset as needed and then use the ORDER=DATA option of the PROC FREQ statement.
proc sort data=MSM2017; by descending MSM descending Alerts; run; proc freq data=MSM2017 order=data; tables MSM*Alerts/RELRISK; WEIGHT COUNTS ; RUN;
Note however, how wide the 95% confidence interval for this relative risk is (due to the small numbers in column 2, as Reeza mentioned).
Edit: If you also want to report the odds ratio, you should switch the columns as well (see extended BY statement above; the relative risk is then reported as that of "Column 1"). Thanks to @Reeza for pointing this out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Dhana18,
@Dhana18 wrote:
My colleague got RR of 10.57 using excel
That value is correct and you'll obtain it also with SAS (for "Column 2," i.e., Alerts='Yes') if you switch the rows of the 2x2 table, i.e., have MSM='Yes' as the first row, so that the relative risk is the risk ratio of MSM='Yes' vs. MSM='No' and not vice versa (which is what you currently get: 0.09465... = 1/10.5652...). One way to achieve this is to sort the dataset as needed and then use the ORDER=DATA option of the PROC FREQ statement.
proc sort data=MSM2017; by descending MSM descending Alerts; run; proc freq data=MSM2017 order=data; tables MSM*Alerts/RELRISK; WEIGHT COUNTS ; RUN;
Note however, how wide the 95% confidence interval for this relative risk is (due to the small numbers in column 2, as Reeza mentioned).
Edit: If you also want to report the odds ratio, you should switch the columns as well (see extended BY statement above; the relative risk is then reported as that of "Column 1"). Thanks to @Reeza for pointing this out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content