Dear
I am using below proc template code to output a forest plot. I have a question in graph part of the plot which is output by code under fifth column below. All the tick value list mentioned is not %let statement is not seen x axis part of graph. I see only three values(-40 0 40). How to modify my code output all values (-40 -20 0 20 40). The graph part is attached. Please help. Thank you.
%let tickvaluelist=%str(-40.0 -20.0 0.0 20.0 40.0);
%let colwgt=(0.35 0.13 0.15 0.20 0.22);
proc template;
define statgraph Forest_HighLow;
dynamic _color _headercolor;
begingraph;
layout lattice / columns=5 columnweights=&colwgt;
/*--Column headers--*/
sidebar / align=top;
layout lattice / rows=1 columns=5 columnweights=&colwgt
backgroundcolor=_headercolor opaque=true;
entry " ";
entry textattrs=(size=8.6 weight=bold) "N/# pCR";
entry textattrs=(size=8.6 weight=bold) "&_clm_label";
entry textattrs=(size=8.6 weight=bold) "95% CI";
entry " ";
endlayout;
endsidebar;
/*--First column: subgroup label */
layout overlay / walldisplay=none
xaxisopts=(display=none linearopts=(viewmin=0 viewmax=4))
yaxisopts=(reverse=true display=none tickvalueattrs=(weight=bold)) ;
highlowplot y=rownum low=zero high=zero / highlabel=heading
lineattrs=(thickness=0) labelattrs=(weight=bold size=8.6);
highlowplot y=rownum low=zero high=one / highlabel=subgroup
lineattrs=(thickness=0) labelattrs=(size=8.6);
endlayout;
/*--Second column: sample size --*/
layout overlay / xaxisopts=(display=none)
yaxisopts=(reverse=true display=none) walldisplay=none;
scatterplot y=rownum x=zero / markercharacter=n
markercharacterattrs=graphvaluetext(size=8.6);
endlayout;
/*--Third column: point estimate --*/
layout overlay / xaxisopts=(display=none)
yaxisopts=(reverse=true display=none) walldisplay=none;
scatterplot y=rownum x=zero / markercharacter=hr
markercharacterattrs=graphvaluetext(size=8.6);
endlayout;
/*--Fourth column: CI --*/
layout overlay / xaxisopts=(display=none)
yaxisopts=(reverse=true display=none) walldisplay=none;
scatterplot y=rownum x=zero / markercharacter=ci
markercharacterattrs=graphvaluetext(size=8.6);
endlayout;
/*--Fifth column: plot of point estimate and CI --*/
layout overlay / xaxisopts=(label="_lgd_label"
labelattrs=(size=8.6 weight=bold)
linearopts=(tickvaluepriority=true
tickvaluelist=(&tickvaluelist)))
yaxisopts=(reverse=true display=none) walldisplay=none;
highlowplot y=rownum low=low high=high ;
scatterplot y=rownum x=hrr /
markerattrs=(symbol=squarefilled size=8.6);
referenceline x=0 ;
endlayout;
endlayout;
endgraph;
end;
run;
%let tickvaluelist=%str(-40.0 -20.0 0.0 20.0 40.0);
%let colwgt=(0.35 0.13 0.15 0.20 0.22);
proc template;
define statgraph Forest_HighLow;
dynamic _color _headercolor;
begingraph;
layout lattice / columns=5 columnweights=&colwgt;
/*--Column headers--*/
sidebar / align=top;
layout lattice / rows=1 columns=5 columnweights=&colwgt
backgroundcolor=_headercolor opaque=true;
entry " ";
entry textattrs=(size=8.6 weight=bold) "N/# pCR";
entry textattrs=(size=8.6 weight=bold) "&_clm_label";
entry textattrs=(size=8.6 weight=bold) "95% CI";
entry " ";
endlayout;
endsidebar;
/*--First column: subgroup label */
layout overlay / walldisplay=none
xaxisopts=(display=none linearopts=(viewmin=0 viewmax=4))
yaxisopts=(reverse=true display=none tickvalueattrs=(weight=bold)) ;
highlowplot y=rownum low=zero high=zero / highlabel=heading
lineattrs=(thickness=0) labelattrs=(weight=bold size=8.6);
highlowplot y=rownum low=zero high=one / highlabel=subgroup
lineattrs=(thickness=0) labelattrs=(size=8.6);
endlayout;
/*--Second column: sample size --*/
layout overlay / xaxisopts=(display=none)
yaxisopts=(reverse=true display=none) walldisplay=none;
scatterplot y=rownum x=zero / markercharacter=n
markercharacterattrs=graphvaluetext(size=8.6);
endlayout;
/*--Third column: point estimate --*/
layout overlay / xaxisopts=(display=none)
yaxisopts=(reverse=true display=none) walldisplay=none;
scatterplot y=rownum x=zero / markercharacter=hr
markercharacterattrs=graphvaluetext(size=8.6);
endlayout;
/*--Fourth column: CI --*/
layout overlay / xaxisopts=(display=none)
yaxisopts=(reverse=true display=none) walldisplay=none;
scatterplot y=rownum x=zero / markercharacter=ci
markercharacterattrs=graphvaluetext(size=8.6);
endlayout;
/*--Fifth column: plot of point estimate and CI --*/
layout overlay / xaxisopts=(label="_lgd_label"
labelattrs=(size=8.6 weight=bold)
linearopts=(tickvaluepriority=true
tickvaluelist=(&tickvaluelist)))
yaxisopts=(reverse=true display=none) walldisplay=none;
highlowplot y=rownum low=low high=high ;
scatterplot y=rownum x=hrr /
markerattrs=(symbol=squarefilled size=8.6);
referenceline x=0 ;
endlayout;
endlayout;
endgraph;
end;
run;
Sorry I clicked the Post button before I wrote my question . I just posted my question. My question regarding tick values in graph part of forest plot. Thank you.
@knveraraju91 you can edit your posts by clicking the little gear button at the top of the post.
I've merged them into one post here.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.