BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

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;




 

5 REPLIES 5
knveraraju91
Barite | Level 11

 

 


%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;




JeffMeyers
Barite | Level 11
What's the question?
knveraraju91
Barite | Level 11

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.

 

 

Reeza
Super User

@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.

JeffMeyers
Barite | Level 11
I would suggest setting viewmin=-40 and viewmax=40, offsetmin=0, offsetmax=0, and tickvaluefitpolicy=none.

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
  • 5 replies
  • 1316 views
  • 1 like
  • 3 in conversation