We have used proc sgpanel to create heatmap. Although have used sortorder=descending in the keylegend statement, the legend is not sorted as per the expectation, i.e. 4,3,2,1,0,-1,-2,-3,-4. I have tried using proc sort with force option to sort the attrmap dataset, but that didn't help either. Any help/suggestions would be much appreciated. /* Define attribute map for CHG value colors */
data attrmap;
length id $20 value 8 fillstyle $10 fillcolor $20;
id='colormap';
value=-4; fillstyle='solid'; fillcolor='DELG'; output;
value=-3; fillstyle='solid'; fillcolor='VILG'; output;
value=-2; fillstyle='solid'; fillcolor='BILG'; output;
value=-1; fillstyle='solid'; fillcolor='LIGY'; output; /* brown */
value= 0; fillstyle='solid'; fillcolor='white'; output;
value= 1; fillstyle= 'solid'; fillcolor='cxfca5a5'; output;
value= 2; fillstyle='solid'; fillcolor='cxfb7171'; output;
value= 3; fillstyle='solid'; fillcolor='RED'; output;
value= 4; fillstyle='solid'; fillcolor='VIPK'; output;
run;
proc sgpanel data=out.HeatmapF noautolegend dattrmap=attrmap;
panelby trt_label_sort / sort=descending layout=columnlattice onepanel colheaderpos=top novarname uniscale=row proportional;
heatmapparm x=ordern y=paramcd_label colorgroup=CHG / attrid=colormap outline discretex discretey;
keylegend / position=bottom title="Change from Baseline" sortorder=descending ;
colaxis grid label="Subject" valueattrs=(size=3.5);
rowaxis min=0 max=200 label=" PART 2 PART 1 " reverse;
run;
... View more