BookmarkSubscribeRSS Feed
ShaneRosanbalm
Obsidian | Level 7

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;

 

heatmap.png

5 REPLIES 5
ballardw
Super User

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.

ShaneRosanbalm
Obsidian | Level 7

@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!

ballardw
Super User

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;
Ksharp
Super User

Remove 'rattrmap=rdbl5std'  and  'rattrid=rdbl5std' .

ShaneRosanbalm
Obsidian | Level 7
@Ksharp, thanks for the suggesting, but removing the range attribute map would not produce the type of plot I need. The default color response behavior does not provide the blocks of constant color that are needed in this application.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1228 views
  • 0 likes
  • 3 in conversation