Hello All,
My Sgplot code looks like below and the Legend that appearing "Name = a " ( Treatment arms ) at the end of Vbox . Along with that I also want the Scatter Plot colors in the Legend , if I try to have Name = "Scat" and use it in Keylegend TRT01A is coming up as it is Grouping variable . How to get the Scatter Plot color into the Legend ?
Example along with TRT arm , red color = &var2. , Green color = &var1 something like this
%macro box_j (yvar , var1,var2 , out , Vis , label );
/*--Grouped Box with Stat Table Scatter--*/;
ods graphics / reset attrpriority=color width=5in height=3in imagename= "&out._&vis._Box_jitter" ;
Title "Boxplot ";
proc sgplot data=mergedGroup ;
label value='N'; format value 5.2;
yaxis values = (-6 to 6 by 2);
vbox &yvar. / category= &var2. group=TRT01A nooutliers nofill grouporder=ascending name='a';
scatter x=&var2. y=&yvar. / group=TRT01A groupdisplay=cluster
grouporder=ascending jitter
markerattrs=(symbol=circlefilled size=5 color = red )
transparency=0.5 clusterwidth=0.5 *Name = "Scat" * ; <-- I want &var2 color in the Legend
scatter x=&var1. y=&yvar. / group=TRT01A groupdisplay=cluster
grouporder=ascending jitter
markerattrs=(symbol=square size=5 color = green )
transparency=0.65 clusterwidth=1; <-- I want &var1 color in the Legend
xaxistable STD / x=cat class=grp classdisplay=cluster colorgroup=grp location=inside classorder=ascending label = "&var2.";
xaxis display=(nolabel);
keylegend 'a' / linelength=24;
*keylegend 'Scat' / linelength=24;
run;
QUIT;
%MEND box_j;
%box_j(lV4 , TRT,FR , log , V4 ,%str( V4 ) );