SGPANEL过程为一个或多个分类变量的值创建一组图形单元格。 例如,如果数据集包含三个变量(A,B和C),并且您想要比较每个A值的B * C的散点图,则可以使用SGPANEL创建此面板。 SGPANEL过程自动创建一个布局,如有必要,将面板拆分成多个图形。
SGPANEL程序可以创建各种绘图类型,并在面板中的每个图形单元格中叠加多个绘图。 它也可以生成几种类型的布局。 可由SGPANEL过程生成的面板示例包含SGPANEL过程可以创建的面板示例。
proc sgpanel 案例1
代码:
/*The following code creates a panel of loess curves:*/
title1 "Cholesterol Levels for Age > 60";
proc sgpanel data=sashelp.heart(
where=(AgeAtStart > 60)) ;
panelby sex / novarname;
loess x=weight y=cholesterol / clm;
run;
title1 "Cholesterol Levels for Age > 60";
proc sgpanel data=sashelp.heart(where=(AgeAtStart > 60)) ;
panelby sex / novarname;
loess x=weight y=cholesterol / clm;
run;
/*以下代码创建一个垂直条形图面板:*/
title1 "Product Sales"; proc sgpanel data=sashelp.prdsale; panelby quarter; rowaxis label="Sales"; vbar product / response=predict stat=mean transparency=0.3; vbar product / response=actual stat=mean barwidth=0.5 transparency=0.3; run;
以下代码创建一个具有直方图和正常密度曲线的单元格面板:
Title1 "Weight Distribution in the Heart Study"; proc sgpanel data=sashelp.heart noautolegend; panelby sex / novarname; histogram weight; density weight; run;
/*以下代码在格子布局中创建一个框图:*/
title1 "Distribution of Cholesterol Levels"; proc sgpanel data=sashelp.heart; panelby weight_status sex / layout=lattice novarname; hbox cholesterol; run;