Hi Everyone,
Is there any way to control the spacing on y-axis between each subgroup of a forest plot.
For example:
Age <=65
Age >75
Male
Female
White
Non White
etc..
Thanks for your help
You might want to state which version of SAS you are using as the SG procedures have gone through lots of improvements in the last few releases. My first likely solution is for an older versiona but I believe there have been options added that might do what you need.
Also posting your code and an example of the data might make responses quicker.
Hi:
I believe there is a GTL example of a FOREST plot, as well as an SG Procedure example of a FOREST plot. You should be able to search in support.sas.com to find the example links. See screen shots.
cynthia
Thanks Ballard and Cynthia,
I'm using SAS 9.3 on windows. Yes, there is an example from Sanjay's blog using GTL but I was trying to output similar output using SGPLOT. But the problem is, I couldn't group them together with a space in between each group.
Below is the code i'm using
proc sgplot data=forest&i noautolegend;
scatter y = subgroup x = orval / xerrorupper = upper_limit
xerrorlower = lower_limit
markerattrs = graphdata1 (symbol = squarefilled);
scatter y = subgroup x = trt1_lbl / markerchar = Trt1cnt x2axis;
scatter y = subgroup x = trt2_lbl / markerchar = Trt2cnt x2axis;
scatter y = subgroup x = or_lbl / markerchar = OddRatio x2axis;
scatter y = subgroup x = pval_lbl / markerchar = pvalue x2axis;
refline 1 5 / axis = x;
inset ' Favors Treatment' / position = bottomleft;
inset 'Favors Control ' / position = bottom;
xaxis type = log offsetmin = 0.02 offsetmax = 0.35
min = 0.05 max = 20 minor display = (nolabel) grid;
x2axis offsetmin = 0.7 display = (noticks nolabel) offsetmax = 0.05;
yaxis display = (noticks nolabel) offsetmin = 0.02 offsetmax = 0.02;
run;
Thanks
Hi:
Without a sample of YOUR data, it's impossible to understand what you mean. My suggestion is that you post this question, with code and data over in the ODS Graphics forum. Sanjay will look at and answer questions that are posted over there, and since he is the author of all the FOREST plot examples that I know of, he's the expert in this area.
cynthia
One of the classic ways is to add a value in each sub group with an associated y value of missing or zero. Playing some games with the value formats to indicate a blank or possibly just a vertical line to indicate a spacer is often possible. Just make sure that the added subgroup value is either last or first in value.
Thanks Ballard.
I did try that approach by plugging in a blank record after each subgroup, but I was not able to get that extra blank (Maybe because the oddsratio, which I was trying to plot is missing).
Thanks
By "blank record" do you mean all values missing? or just the results?
Sorry, I meant just the results..I have everything else populated.
Thanks
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.