ods html close; /*--This data sets has regular blanks for indentatin of the subgroup text--*/ data forest; input Subgroup $1-25 Count Percent Mean Low High PCIGroup Group PValue; zero=0; PCI_lbl='PCI group'; grp_lbl='Group'; sub_lbl='Subgroup'; pval_lbl='-'; if count ne . then CountPct=put(count, 4.0) || "(" || put(percent, 3.0) || ")"; id=_n_; val=mod(_N_-1, 6); if val eq 1 or val eq 2 or val eq 3 then do; ref=subgroup; idref=id; end; datalines; Overall 2166 100 1.3 0.9 1.5 17.2 15.6 . Age . . . . . . . 0.05     <= 65 Yr 1534 71 1.5 1.05 1.9 17.0 13.2 .      > 65 Yr 632 29 0.8 0.6 1.25 17.8 21.3 . Sex . . . . . . . 0.13     Male 1690 78 1.5 1.05 1.9 16.8 13.5 .     Female 476 22 0.8 0.6 1.3 18.3 22.9 . Race or ethnic group . . . . . . . 0.52     Nonwhite 428 20 1.05 0.6 1.8 18.8 17.8 .     White 1738 80 1.2 0.6 1.6 16.7 15.0 . From MI to Randomization . . . . . . . 0.81     <= 7 days 963 44 1.2 0.8 1.5 18.9 18.6 .      > 7 days 1203 56 1.15 0.75 1.5 15.9 12.9 . Infract-related artery . . . . . . . 0.38     LAD 781 36 1.4 0.9 1.9 20.1 16.2 .     Other 1385 64 1.1 0.8 1.4 15.6 15.3 . Ejection Fraction . . . . . . . 0.48     < 50% 1151 54 1.2 0.8 1.5 22.6 20.4 .     >= 50% 999 46 0.9 0.6 1.4 10.7 11.1 . Diabetes . . . . . . . 0.41     Yes 446 21 1.4 0.9 2.0 29.3 23.3 .     No 1720 79 1.1 0.8 1.5 14.4 13.5 . Killip class . . . . . . . 0.39     I 1740 81 1.2 0.8 1.6 15.2 13.1 .     II-IV 413 19 0.95 0.6 1.5 25.3 26.9 . ; run; ods html; proc print data=forest(obs=5) noobs; var subgroup mean low high pcigroup group; run; ods html close; /*--Leading blanks in the subgroup variable must be non--blank spaces --*/ /*--Use character value 'A0', or copy from Windows System Character Map--*/ /*--Regular leading blanks will be stripped, losing the indentation --*/ data forest_nbsp; input Subgroup $1-25 Count Percent Mean Low High PCIGroup Group PValue; zero=0; PCI_lbl='PCI group'; grp_lbl='Group'; sub_lbl='Subgroup'; pval_lbl='-'; if count ne . then CountPct=put(count, 4.0) || "(" || put(percent, 3.0) || ")"; id=_n_; val=mod(_N_-1, 6); if val eq 1 or val eq 2 or val eq 3 then do; ref=subgroup; idref=id; end; datalines;   Overall                2166 100 1.3 0.9 1.5 17.2 15.6 .   Age                    . . . . . . . 0.05     <= 65 Yr             1534 71 1.5 1.05 1.9 17.0 13.2 .      > 65 Yr              632 29 0.8 0.6 1.25 17.8 21.3 .   Sex                    . . . . . . . 0.13     Male                 1690 78 1.5 1.05 1.9 16.8 13.5 .     Female                476 22 0.8 0.6 1.3 18.3 22.9 .   Race or ethnic group   . . . . . . . 0.52     Nonwhite              428 20 1.05 0.6 1.8 18.8 17.8 .     White                1738 80 1.2 0.6 1.6 16.7 15.0 .   From MI to Random      . . . . . . . 0.81     <= 7 days            963 44 1.2 0.8 1.5 18.9 18.6 .      > 7 days            1203 56 1.15 0.75 1.5 15.9 12.9 .   Infract-related artery . . . . . . . 0.38     LAD                   781 36 1.4 0.9 1.9 20.1 16.2 .     Other                1385 64 1.1 0.8 1.4 15.6 15.3 .   Ejection Fraction      . . . . . . . 0.48     < 50%                1151 54 1.2 0.8 1.5 22.6 20.4 .     >= 50%              999 46 0.9 0.6 1.4 10.7 11.1 .   Diabetes               . . . . . . . 0.41     Yes                  446 21 1.4 0.9 2.0 29.3 23.3 .     No                   1720 79 1.1 0.8 1.5 14.4 13.5 .   Killip class           . . . . . . . 0.39     I                    1740 81 1.2 0.8 1.6 15.2 13.1 .     II-IV                 413 19 0.95 0.6 1.5 25.3 26.9 . ; run; /*proc print;run;*/ ods html; proc print data=forest_nbsp(obs=5) noobs; var subgroup mean low high pcigroup group; run; ods html close; %let gpath='C:\'; %let dpi=200; ods listing gpath=&gpath image_dpi=&dpi; /*--Forest plot with regular blanks for indentation and Y axis--*/ /*%let font='Lucida Console';*/ %let font='Consolas'; ods graphics / reset width=4in height=3in imagename='Forest_1'; proc sgplot data=forest noautolegend; refline 1.0 / axis=x; scatter y=subgroup x=mean / xerrorlower=low xerrorupper=high markerattrs=(symbol=circlefilled); scatter y=subgroup x=pci_lbl / markerchar=pcigroup x2axis; scatter y=subgroup x=grp_lbl / markerchar=group x2axis; xaxis display=(nolabel noticks) offsetmin=0.5 values=(0 to 2 by 0.5) valueattrs=(size=6); x2axis display=(nolabel noticks) offsetmax=0.7 valueattrs=(size=6); yaxis reverse display=(noticks nolabel) valueattrs=(size=6); run; /*--Forest plot with regular blanks for indentation MarkerChar--*/ %let font='Consolas'; ods graphics / reset width=4in height=2.5in imagename='Forest_2'; proc sgplot data=forest noautolegend; /* refline idref / axis=y lineattrs=(thickness=9 color=cxdfdfdf);*/ refline 1.0 / axis=x; scatter y=id x=mean / xerrorlower=low xerrorupper=high markerattrs=(symbol=circlefilled); scatter y=id x=sub_lbl / markerchar=subgroup x2axis markercharattrs=(family=&font weight=bold); scatter y=id x=pci_lbl / markerchar=pcigroup x2axis; scatter y=id x=grp_lbl / markerchar=group x2axis; xaxis display=(nolabel noticks) offsetmin=0.6 values=(0 to 2 by 0.5); x2axis display=(nolabel noticks) offsetmax=0.5; yaxis reverse display=none; run; /*--Forest plot with nbsp blanks for indentation and MarkerChar--*/ %let font='Consolas'; ods graphics / reset width=4in height=2.5in imagename='Forest_NBSP'; proc sgplot data=forest_nbsp noautolegend; refline idref / axis=y lineattrs=(thickness=9 color=cxf0f0f0); refline 1.0 / axis=x; scatter y=id x=mean / xerrorlower=low xerrorupper=high markerattrs=(symbol=circlefilled); scatter y=id x=sub_lbl / markerchar=subgroup x2axis markercharattrs=(family=&font weight=bold); scatter y=id x=pci_lbl / markerchar=pcigroup x2axis; scatter y=id x=grp_lbl / markerchar=group x2axis; xaxis display=(nolabel noticks) offsetmin=0.6 values=(0 to 2 by 0.5) valueattrs=(size=7); x2axis display=(nolabel noticks) offsetmax=0.5 valueattrs=(size=7); yaxis reverse display=none; run;