%macro coplot3(data,x,y,panelvar); proc univariate data=&data noprint; var &panelvar; output out=Pctls pctlpts=33 67 pctlpre=P_ pctlname=P33 P67; run; proc print;run; data _null_; set Pctls; call symput('P33',left(put(P_P33,best10.))); call symput('P67',left(put(P_P67,best10.))); run; data z_coplot; set &data; pctile=' 0_33'; if &panelvar>&P33 then pctile=' 33_67'; if &panelvar>&P67 then pctile=' 67_100'; run; title Coplot of 'x Variable' &x ', y Variable' &y ', Grouped by' &panelvar 'Percentiles'; proc sgpanel data=z_coplot; panelby pctile/rows=1 columns=3; scatter x=&x y=&y; run; title Coplot with Loess of 'x Variable' &x ', y Variable' &y ', Grouped by' &panelvar 'Percentiles'; proc sgpanel data=z_coplot; panelby pctile/rows=1 columns=3; loess x=&x y=&y; run; title ' '; %mend coplot3; %coplot3(ma2612.cars93a,displace,highmpg,hp); %coplot3(ma2612.cars93a,displace,highmpg,rpm); %coplot3(ma2612.cars93a,rpm,highmpg,hp); %coplot3(ma2612.cars93a,rpm,highmpg,displace); %coplot3(ma2612.cars93a,hp,highmpg,displace); %coplot3(ma2612.cars93a,hp,highmpg,rpm);