I want to change the color ramp of my heatmap plot. I make a heatmap plot using a graphical template language. My response variable is in percentage form. So, I want to make the colormodel represent the value between 0 to 100 percent, blue color for low percentage (0% to 10%), white color for 10% to 20%, and red color for more than 20%. But my response variable (colorresponse) is range between 0 to around 20 percent, which caused different output from what I want. The color range follow the response variable's range (0 to 20%). Here is the code I've tried.
proc template;
define statgraph training;
begingraph /DESIGNHEIGHT=550px DESIGNWIDTH=650px;
entrytitle 'Heatmap of Digit Check';
layout overlay /yaxisopts=(label="Date" tickvalueattrs=(size=8pt)) xaxisopts=(label="Last Digit" tickvalueattrs=(size=8pt));
heatmapparm y=day x=ld colorresponse=percent / display=all name='percent' colormodel=(blue white red);
scatterplot x=sbp_ld y=day /markercharacter=percent markercharacterattrs=(size=8);
continuouslegend 'percent';
endlayout;
endgraph;
end;
run;
proc sgrender data=digit_check template=training;
run;
Here is the result.
Could anyone help me on this? Thank you for any help you can offer.
Regards,
Mifta
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.