I am producing a HEATMAP in SGPLOT 9.4m4. I am trying to use the INTEGER option in the GRADLEGEND statement so that my color response legend only shows integer tick values (-2, -1, 0, 1, 2). Instead of getting integer tick values I am getting tick values that align with the MIN/MAX values coming out of my RATTRMAP dataset. Is this expected behavior? I don't see anything in the documentation to suggest that RATTRMAP overrides INTEGER. But maybe I haven't looked closely enough.
proc sgplot data=alerts rattrmap=rdbl5std ;
heatmap y=functionn x=monthyear /
colorresponse=loadstd rattrid=rdbl5std
discretex discretey outline outlineattrs=(color=lightgray)
;
yaxis reverse display=(nolabel);
xaxis display=(nolabel);
gradlegend / position=bottom INTEGER;
run;
If you defined multiple ranges in the RATTRMAP data that would be expected behavior. If you only have a single range for the rattrid value you might want to show the attribute data set. Or possibly add the EXCLUDEMIN and EXLCUDEMAX variables to the attribute data if you have multiple ranges for the id group.
It might not hurt to provide a small example of your plot data set and the attribute set so we test code with the values.
@ballardw, thanks for the offer! Attached is a complete program and CSV data to create the above graphic. You need only change the value of &PATH at the top. Have fun playing!
1) you want to actually test any proc import code provided. You needed a guessingrows=max option to keep the function variables from getting truncated.
2) because the range of your COLORRESPONSE variable LOADSTD ranges from -2 to about 1.5 the color gradient does not center in the "white" section using the INTEGER option that will display the integer values.
It appears that to get your color choices and integer appearance may have conflict and you'll have to choose between the color gradient and the labels as which is more important.
Perhaps you can get something workable with careful choices in a COLORMODEL.
proc sgplot data=alerts ; heatmap y=functionn x=monthyear / colorresponse=loadstd colormodel = (cx0571b0 white cxca0020) discretex discretey outline outlineattrs=(color=lightgray) ; yaxis reverse display=(nolabel); xaxis display=(nolabel); gradlegend / position=bottom integer title="(under) Standardized FTE Utilization Differential (over)"; run; title;
Remove 'rattrmap=rdbl5std' and 'rattrid=rdbl5std' .
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.