BookmarkSubscribeRSS Feed
rutherfa12
Calcite | Level 5

Hi Everyone,

 

I have just started my Graduate degree, and for my meta-analysis course we are using SAS.

I have never used this program, as my preferred STATS program in my undergrad was RStudio.

 

I have managed to import my data set and generate a table for it in SASuniversity.

 

I now need to make a funnel plot and forest plot, but do not even know where to start (and our course has no guidelines).

 

If anyone is able to help me with this, I would be forever grateful! I have attached my data set, and below is my code I used to import and generate a table for the first steps of my homework.

 

Code:

PROC IMPORT DATAFILE="/folders/myfolders/sasuser.v94/MOZARTlecture4/Mozart_dataset.xlsx"
OUT=WORK.mozart_data
DBMS=XLSX
REPLACE;
RUN;

/** Print the results. **/

PROC PRINT DATA=WORK.mozart_data; RUN;

8 REPLIES 8
WarrenKuhfeld
Ammonite | Level 13

Start by googling. Sanjay, me, and others have all written extensively about forest plots.

rutherfa12
Calcite | Level 5
I have extensively, but this being the first time I have used SAS, the code your provide in some of the articles I have read are difficult for me to decipher.

I need a beginners step by step guide.
Are there any books your would recommend?
Reeza
Super User
Have you tried following through one of the blog posts - pick the one that's closest to the output you want?
My usual approach is to find something similar enough, make sure the example code works and then wrangle my data into the same format the example data used.
Rick_SAS
SAS Super FREQ

Here are a few hints to help you get started:

  1. The main plotting procedure is PROC SGPLOT.
  2. The most common way to create a forest plot is to plot the average effect (MD) on the X axis and the study ID (Study_ID ) on the vertical axis. This is done by using the SCATTER statement. So read about the SCATTER statement. STEP 1: Create a scatter plot of these two variables.
  3. There are two different treatments in the studies. It would be nice to draw them in different colors, right? Look up the GROUP= option on the SCATTER statement. STEP 2: modify the scatter plot so that it displays the two treatments in different colors.
  4. To incorporate the confidence limits, look up examples of how to use the XERRORLOWER= and XERRORUPPER= options. STEP 3: Modify the scatter plot to incorporate the confidence limits.  I do not know what LCL is versus LCL_2, so ask your instructor or a friend how you should create the confidence limits.
  5. Sometimes in a forest plot, it is useful to plot a reference line at 0 to show which studies had CLs that included 0 ("no difference") as a possible conclusion. You can look up the REFLINE statement to see how to add a reference line at x=0 on the X axis. STEP 4 (optional): Add a reference line at MD=0.
Ksharp
Super User

Calling @Rick_SAS  for funnel plot.

Rick just wrote a blog about it . Search at 

https://blogs.sas.com/content/

JeffMeyers
Barite | Level 11

Hello,

   Making forest plots is generally a tedious process when it comes to actually performing the analysis and putting the data set together.  It looks like you've already done this for the most part.  From there you can use simple tools like SCATTER, HIGHLOW, and YAXISTABLE in SGPLOT to take care of the heavy lifting.  I have a paper/macro that makes forest plots while also automating the analysis, but perhaps you'd be interested in reading about the methods I use (which are a bit more advanced).

 

https://communities.sas.com/t5/SAS-Communities-Library/MVMODELS-a-Macro-for-Survival-and-Logistic-An...

 

JB1_DK
Fluorite | Level 6

This blog post has complete code on how you make a Forest plot using data that you have available in SAS as a sample data set. You can then replace the data with your own data:

https://blogs.sas.com/content/graphicallyspeaking/2017/10/22/tips-tricks-segmented-discrete-axis/

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 8 replies
  • 2022 views
  • 2 likes
  • 7 in conversation