Programming the statistical procedures from SAS

Forest plot

Reply
Regular Contributor
Posts: 173

Forest plot

ANy ideas about how to  create a forest plot in SAS? or in Excel?

Here is the data that i have to plot the forest plot

This is how my plot looks like..

SAS Super FREQ
Posts: 3,547

Forest plot

Regular Contributor
Posts: 173

Forest plot

Thanks Rick for this, it helps. Is there also a way in Excel to do the forest plot?

Super User
Posts: 18,580

Forest plot

You need to calculate the data for the forest plot in Excel.

Basically, you create a scatterplot with error bars (google this and you'll find a lot of examples and detailed instructions). And add a reference line at 1 manually or with another series.

http://www.stattools.net/ForestPlot_Exp.php

About halfway down the page.

Regular Contributor
Posts: 173

Forest plot

Thanks Reeza for your response, Yes, I do have the data and i have already viisted the link that you have given here. I was stuck at the log scale conversion step and couldnot prooceed further, so still trying to look up for more help..

Super User
Posts: 18,580

Forest plot

What version of Excel do you have? In 2003 you right click your x axis>Format Axis>Scale at the bottom is the check box for log scale.

This depends on what the scale of your data is.

You can alos modify where the line is by changing the Value(Y) axis Crosses at in the same dialog box to 1 if you're doing OR plots.

Another and better option if your comparing OR's from SAS in my opinion is turning on ODS graphics for proc logistics. The default procedure will produce something similar to a forest plot. Obviously this isn't appropriate if you're doing a meta analysis.

Regular Contributor
Posts: 173

Forest plot

I have attached the data in the original post now. Please have a look at it.. somehow , the graph only  hows UCL and OR. and shows LCL only for one data point. Somehting is wrong there.

Mine is windows XP, excel 2003 , .

Regular Contributor
Posts: 173

Forest plot

now i have attached the file in which you  can see how it looks like.. i tried it again, biut not sure why it is vertical and ot horizontal..

Any idea?

Super User
Posts: 18,580

Forest plot

Create a scatter plot of ONLY your OR and have the Y values be 1/2/3 etc, some count that puts them in the order you want to display and the OR along the X axis.

Change your graph to not show any gridlines, except the one at y=1

Calculate the +/- values for each arm (based on the CI you already have).

Add x error bars individually for each point based on the +/- bars

Right click on the error bars and format them to not have the end points.

A very very manual process in my opinion which is why SAS and SGPLOT are useful

Regular Contributor
Posts: 173

Forest plot

Okay I understadn until step3.

For step 4, how do i add x error bars...not sure of that.

I have got 3 different ORs (with CI) after running 3 different Proc logistics. So even if i want to create the forest plot in SAS, how do i do that by turning on ODS graphic whie running any one of the proc logistic?

Super User
Posts: 18,580

Forest plot

Right click points and Format Data Series, one of the tabs is X error bars.

Regular Contributor
Posts: 173

Forest plot

Great Reeza,.. this seems to work. I am almost there BUT NOW .. it is not letting me select one point at a time, I have 3 diff ORs with  diff LCL and UCL. I am not able to select each point at a time and enter its LCL and UCL.. How do i do that?

And at what point should I change the scale to log scale.?

Regular Contributor
Posts: 173

Forest plot

Thanks som much Reeza, for helping me with this. But i have had any success yet to create this forest plot.  Its just not letting me  select each point at a time and enter its LCL and UCL.. How do i do that?

And at what point should I change the scale to log scale.?

Appreciate if you cvould guide me with this until its completion..

Regular Contributor
Posts: 173

Forest plot

**Have NOT had any success yet...

Super User
Posts: 18,580

Re: Forest plot

Here's an example.

I only have Excel 2010 at home so hopefully it works.

Good luck.

Ask a Question
Discussion stats
  • 20 replies
  • 2535 views
  • 0 likes
  • 5 in conversation