BookmarkSubscribeRSS Feed
Lapis Lazuli | Level 10

data work.forest;

  input subgroup $1-16 count person-yr event crude HR LowerCL UpperCL;


age 34123 34523 74 9  0.590 0.096 3.634 

<65 12451 43541 86 10 0.464 0.201 1.074 

>65 23451 54211 96 11 0.394 0.076 2.055; 



I am trying to create a forest plot that shows the above information. I want the bars to reflect the hazard ratio and lower/upper CI and all other information to be listed on the side of the bars (count, person-yr, event). Any help is much appreciated! Something that looks like the graph below but with different information. 

Image result for forest plot

Super User

Looks pretty darn close to this blog post:


Code is included in the post.



Lapis Lazuli | Level 10

Thanks Reeza but this code has some errors 

Super User

No errors on my side.


I used the code from here:


You may require SAS 9.4 TS1M3 at least though. 


@lillymaginta wrote:

Thanks Reeza but this code has some errors 


Meteorite | Level 14

Please post the error messages from the log, and the version of SAS (including maintenance level).



Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.


Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 


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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3 in conversation