I created the multi-Panels graph by using the SGPANEL. These graphs include the scatter and the regression graphs. But I want to display the correlation values calculated and converted to a macro variable. Can the values be displayed on the respective panels? If not, what's the other way I can achieve this? We did so much customization in SGPANEL, we trying to keep the SGPANEL.
The following is the example code where we want to display the 'Correlation' values that were converted to macro variables that want to be displayed on the respective 'Sex' panel graphs.
data classfit;
set sashelp.classfit;
if age<=13 then group = 1;
if 13<age<=14 then group =2;
else group = 3;
if sex ='F' then sexn= 1;
else sexn =2;
run;
proc sort data = classfit; by sex sexn; run;
proc corr data=classfit ;*PLOTS=SCATTER(NVAR=all);
var height weight; /* Specify the variables you want to calculate the correlation for */
by sex sexn;
ods output PearsonCorr= corr; /* Create an output dataset to store the correlation values */
run;
data corr (keep = variable weight pweight sex sexn);
set corr ;
where variable = "Height";
run;
data _null_;
set corr;
call symput ('r_'||trim(variable)||trim(left(put(sexn,best.))),trim(put(weight,6.4)));
call symput ('p_'||trim(variable)||trim(left(put(sexn,best.))),trim(put(pweight,6.4)));
run;
%put &r_height1;
ods html;
proc sgpanel data= classfit ;
panelby sex / rows=1 columns=2 sort =data novarname uniscale= column
;*HEADERATTRS=(Color=Navy Family=Arial Size=8
Weight=Bold) HEADERBACKCOLOR=salmon;
scatter x= height y = weight / group = sex markerattrs=(symbol=diamond );
reg x= height y = weight / /*datalabel=trt01p*/ ;
colaxis fitpolicy=ROTATEALWAYS VALUESROTATE=DIAGONAL2
;
rowaxis LABELATTRS=( Weight=Bold) label= 'xxx' grid ;
run;
Thank you for your feed back
... View more