Thank you Sanjay!!! I am working on one your forest plot example. i am just trying to achieve different layout which i attached in my first post. i got unexpected plot, the following is sample data and code data: data test; informat subgroup $25.; input Subgroup & allpat Count med &$13 mean low high _count _med &$13 _mean _low _high hr &$13; datalines; Overall 4432 2166 1.30(.90-1.5) 1.3 0.90 1.50 2266 1.00(.60-1.2) 1.0 0.60 1.20 1.30(.90-1.5) Age . . . . . . . . . <= 65 Yr 3168 1534 1.50(1.1-1.9) 1.5 1.05 1.90 1634 1.20(.75-1.6) 1.2 0.75 1.60 1.50(1.1-1.9) > 65 Yr 1364 632 0.80(.60-1.3) 0.8 0.60 1.25 732 0.50(.30-.95) 0.5 0.30 0.95 0.80(.60-1.3) ; run; proc template; define statgraph Forest; dynamic _show_bands; begingraph /designwidth=1000px designheight=600px;; layout lattice / columns=8 columngutter=0 columnweights=(0.21 0.09 0.4 0.15 0.4 0.15 0.15 0.35); /*--Column headers--*/ sidebar / align=top; layout lattice / rows=2 columns=8 columnweights=(0.21 0.09 0.4 0.15 0.4 0.15 0.15 0.35); entry textattrs=(size=8) halign=left "Subgroup"; entry textattrs=(size=8) " All Patients"; entry " "; entry textattrs=(size=8) "Control group"; entry " "; entry halign=right textattrs=(size=8) "Other group" ; entry halign=right textattrs=(size=8) "Hazard Ratio(95%)" ; entry " "; entry " "; entry " "; entry halign=right textattrs=(size=6) "_________________________________"; entry halign=right textattrs=(size=6) "_________________________________"; entry halign=right textattrs=(size=6) "_________________________________"; entry halign=right textattrs=(size=6) "_________________________________"; entry halign=right textattrs=(size=6) " "; entry " "; endlayout; endsidebar; /*--First Subgroup column, shows only the Y2 axis--*/ layout overlay / walldisplay=none xaxisopts=(display=none) y2axisopts=(reverse=true display=(tickvalues) tickvalueattrs=(weight=bold)); scatterplot y=subgroup x=zero / markerattrs=(size=0) yaxis=y2; endlayout; /*--Second column showing Count and percent--*/ layout overlay / xaxisopts=(display=none) y2axisopts=(reverse=true display=none) walldisplay=none; if (exists(_show_bands)) referenceline y=ref / yaxis=y2 lineattrs=(thickness=15 color=cxf0f0f0); endif; scatterplot y=subgroup x=zero / markercharacter=allpat yaxis=y2 markercharacterattrs=graphvaluetext; endlayout; /*--3rd column showing PCIGroup and Group columns--*/ layout overlay / x2axisopts=(display=(tickvalues) offsetmin=0.25 offsetmax=0.25) y2axisopts=(reverse=true display=none) walldisplay=none; if (exists(_show_bands)) referenceline y=ref / yaxis=y2 lineattrs=(thickness=15 color=cxf0f0f0); endif; scatterplot y=subgroup x=pat_lbl / markercharacter=count xaxis=x2 yaxis=y2 markercharacterattrs=graphvaluetext; endlayout; /*--4th column showing PCIGroup and Group columns--*/ layout overlay / x2axisopts=(display=(tickvalues) offsetmin=0.25 offsetmax=0.25) y2axisopts=(reverse=true display=none) walldisplay=none; if (exists(_show_bands)) referenceline y=ref / yaxis=y2 lineattrs=(thickness=15 color=cxf0f0f0); endif; scatterplot y=subgroup x=med_lbl / markercharacter=med xaxis=x2 yaxis=y2 markercharacterattrs=graphvaluetext; endlayout; /*--5th/6th column showing PCIGroup and Group columns--*/ layout overlay / x2axisopts=(display=(tickvalues) offsetmin=0.25 offsetmax=0.25) y2axisopts=(reverse=true display=none) walldisplay=none; if (exists(_show_bands)) referenceline y=ref / yaxis=y2 lineattrs=(thickness=15 color=cxf0f0f0); endif; scatterplot y=subgroup x=pat_lbl / markercharacter=_count xaxis=x2 yaxis=y2 markercharacterattrs=graphvaluetext; endlayout; /*--5th/6th column showing PCIGroup and Group columns--*/ layout overlay / x2axisopts=(display=(tickvalues) offsetmin=0.25 offsetmax=0.25) y2axisopts=(reverse=true display=none) walldisplay=none; if (exists(_show_bands)) referenceline y=ref / yaxis=y2 lineattrs=(thickness=15 color=cxf0f0f0); endif; scatterplot y=subgroup x=med_lbl / markercharacter=_med xaxis=x2 yaxis=y2 markercharacterattrs=graphvaluetext; endlayout; /*--7th column showing PCIGroup and Group columns--*/ layout overlay / x2axisopts=(display=(tickvalues) offsetmin=0.25 offsetmax=0.25) y2axisopts=(reverse=true display=none) walldisplay=none; if (exists(_show_bands)) referenceline y=ref / yaxis=y2 lineattrs=(thickness=15 color=cxf0f0f0); endif; scatterplot y=subgroup x= zero/ markercharacter=hr xaxis=x2 yaxis=y2 markercharacterattrs=graphvaluetext; endlayout; /*--Third column showing odds ratio graph--*/ layout overlay / xaxisopts=(label=' <---Favour Contorl group ---- ----Favour Other group--->' linearopts=(tickvaluepriority=true tickvaluelist=(0.0 0.2 0.5 1.0 1.2 1.5 2.0))) y2axisopts=(reverse=true display=none) walldisplay=none; if (exists(_show_bands)) referenceline y=ref / yaxis=y2 lineattrs=(thickness=15 color=cxf0f0f0); endif; scatterplot y=subgroup x=mean / xerrorlower=low xerrorupper=high yaxis=y2 markerattrs=(symbol=circle); *scatterplot y=subgroup x=_mean / xerrorlower=_low xerrorupper=_high yaxis=y2 markerattrs=(symbol=circle); referenceline x=1/ lineattrs=(pattern=solid);; endlayout; endlayout; entryfootnote halign=left textattrs=(size=7) 'The p-value is from the test statistic for testing the interaction between the ' 'treatment and any subgroup variable'; endgraph; end; run; proc template; define style listingSF; parent = Styles.Listing; style GraphFonts from GraphFonts "Fonts used in graph styles" / 'GraphDataFont' = ("<sans-serif>, <MTsans-serif>",7pt) 'GraphValueFont' = ("<sans-serif>, <MTsans-serif>",7pt) 'GraphLabelFont' = ("<sans-serif>, <MTsans-serif>",7pt, bold); ; end; run; ods graphics / reset width=7in height=5in imagename='Forest_Ref_92'; proc sgrender data=test template=Forest; dynamic _show_bands='YES'; run; Thanks sam
... View more