Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
lillymaginta
Lapis Lazuli | Level 10

data work.forest;

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

  datalines;

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; 

run;

 

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

4 REPLIES 4
Reeza
Super User

Looks pretty darn close to this blog post:

 

https://blogs.sas.com/content/graphicallyspeaking/2016/05/30/ctspedia-clinical-graphs-subgrouped-for...

 

Code is included in the post.

 

 

lillymaginta
Lapis Lazuli | Level 10

Thanks Reeza but this code has some errors 

Reeza
Super User

No errors on my side.

 

I used the code from here:

https://blogs.sas.com/content/graphicallyspeaking/files/2016/05/Subgrouped_Forest_Plot_SG_94.txt

 

You may require SAS 9.4 TS1M3 at least though. 

 


@lillymaginta wrote:

Thanks Reeza but this code has some errors 


 

Jay54
Meteorite | Level 14

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

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 2256 views
  • 0 likes
  • 3 in conversation