BookmarkSubscribeRSS Feed
lillymaginta
Lapis Lazuli | Level 10
Subgroup oddsratio LCL UCL 
age<=65          0.68 0.61  0.76
age>65           0.90 0.71  1.14                                                                                              
MI               0.71 0.64  1.84
diabetes         0.71 0.62  0.82                                                                                                
hypertension     0.51 0.45  2.58                                                                                                 
asthma           0.55 0.43  0.70                                                                                               
cancer           0.61 0.54  0.69                                                                                                
hic              0.64 0.53  0.76                                                                                                 
rt               0.67 0.38  1.77                                                                                                
Overall          0.68 0.61  0.46                                                                                                 

Hi i have the following summary table of subgroup analysis, can someone help with a code to draw a forest plot out of this table? thanks 

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Something like this?

 

data have;
input Subgroup$ oddsratio LCL UCL;
datalines;
age<=65          0.68 0.61  0.76
age>65           0.90 0.71  1.14
MI               0.71 0.64  1.84
diabetes         0.71 0.62  0.82
hypertension     0.51 0.45  2.58
asthma           0.55 0.43  0.70
cancer           0.61 0.54  0.69
hic              0.64 0.53  0.76
rt               0.67 0.38  1.77
Overall          0.68 0.61  0.46
;

title "Simple Forest Plot";
ods graphics on;
proc sgplot data=have;
	scatter x=oddsratio y=Subgroup / xerrorlower=LCL xerrorupper=UCL;
run;
title;
lillymaginta
Lapis Lazuli | Level 10

Thank you for the quick reply. I want something that looks like this with the groups listed on the left side, ignores the no of patients, and the odds ratios and confidence intervals on the right side. Also, I need the line that shows that extend from the value 1

 

 

 

Image result for forest plot sas

Rick_SAS
SAS Super FREQ
To add to Draycut's answer, see the discussion and examples in the article "Regression coefficient plots in SAS." For odds ratio plots, see the article "Odds ratio plots with a logarithmic scale in SAS"

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 4 replies
  • 5108 views
  • 5 likes
  • 3 in conversation