HI
I'm working on my first multi celled layout below in version 9.4 1M3 (Win7) and I'm having problems getting the text to be where I want. In the cell titled 'Summary Statistics' I'd like the table to be at the top of the cell and not in the center. And in the 'Quantiles' table I'd like to get the spacing between the lines to be smaller so all the data fits in the cell. The code is below the graph. Any suggestions? Thanks. (And yes, I'm trying to look like the JMP distribution output, which is popular here)
%let pctlv=0 0.5 2.5 25 50 75 90 97.5 99.5 100 ;
proc stdize data=sashelp.cars outstat=_pctls pctlpts= &pctlv. ;;
var horsepower;
run;
data _pctls;
length pctllab $10.;
set _pctls;
if _type_=: 'P';
pctl=input(substr(translate(_type_,'.','_'),2),best12.);
format pctl 6.1;
select (pctl);
when (100) pctllab='maximum';
when (75) pctllab='quartile';
when (50) pctllab='median';
when (25) pctllab='quartile';
when (0) pctllab='minimum';
otherwise pctllab='';
end;
run;
proc sort data=_pctls;
by descending pctl;
run;
data _null_;
set _pctls;
i+1;
ii=left(put(I,3.));
CALL SYMPUT('pctl'||II,pctl);
CALL SYMPUT('lpctl'||II,pctllab);
CALL SYMPUT('vpctl'||II,horsepower);
CALL SYMPUT('total',II);
RUN;
%macro cmplplot;
proc template;
define statgraph sgdesign;
dynamic _HORSEPOWER _WEIGHT ;
begingraph;
entrytitle halign=center 'Type in your title...';
entryfootnote halign=left 'Type in your footnote...';
layout lattice / rows=2 rowgutter=5
rowweights=(0.6 0.4) ;
rowaxes;
rowaxis;
rowaxis;
endrowaxes;
layout overlay / yaxisopts=( griddisplay=off);
scatterplot x=_WEIGHT y=_HORSEPOWER / name='scatter';
endlayout;
layout lattice / columns=3 columngutter=2;
cell;
layout lattice / columndatarange=union rowweights=(preferred .8);
columnaxes;
columnaxis;
columnaxis;
endcolumnaxes;
layout overlay;
boxplot y=_HORSEPOWER / name='box(h)' orient=horizontal;
endlayout;
layout overlay;
histogram _HORSEPOWER / name='histogram' binaxis=false;
endlayout;
endlayout;
endcell;
cell;
cellheader;
layout gridded / border=true opaque=true
backgroundcolor=GraphAltBlock:color;
entry "Summary Statistics" / textattrs=(color=GraphFit:contrastColor);
endlayout;
endcellheader;
layout gridded/ columns=2 border=true autoalign=(topleft)
opaque=true backgroundcolor=GraphWalls:color;
entry halign=left "Mean" ; entry halign=left eval(strip(put(mean(horsepower),12.2)));
entry halign=left "Std Dev"; entry halign=left eval(strip(put(stddev(horsepower),12.2)));
entry halign=left "Std Err Mean"; entry halign=left eval(strip(put(stderr(horsepower),12.2)));
entry halign=left "N"; entry halign=left eval(strip(put(n(horsepower),12.0)));
endlayout;
endcell;
cell;
cellheader;
layout gridded / border=true opaque=true
backgroundcolor=GraphAltBlock:color;
entry "Quantiles" / textattrs=(color=GraphFit:contrastColor);
endlayout;
endcellheader;
layout gridded / columns=3 border=true
opaque=true backgroundcolor=GraphWalls:color;
%do i=1 %to &total;
entry textattrs=(size=7) halign=left "&&pctl&i..%";
entry textattrs=(size=7) halign=right "&&lpctl&i..";
entry textattrs=(size=7) halign=left "&&vpctl&i..";
%end;
endlayout;
endcell;
endlayout;
endlayout;
endgraph;
end;
run;
%mend cmplplot;
%cmplplot;
proc sgrender data=SASHELP.CARS template=sgdesign;
dynamic _HORSEPOWER="HORSEPOWER" _WEIGHT="WEIGHT" ;
run;
... View more