Can someone please explain this white column in the middle of the graph:
I have no missing data btw!
Thank you 🙂
Add the DISCRETEX option to the HEATMAP statement:
title "Injury Frequency by Year and Month";
proc sgplot data=sample;
heatmap
x=year y=MonthName /
colorresponse=COUNT
discretex
;
by InjuryType;
xaxis label="Year" values=(2020 2021 2022 2023 2024);
/* Character Y-axis preserves names; order guaranteed by sorting */
yaxis label="Month of Year" discreteorder=data;
run;
I apologize. There were typos in my earlier messages. Please discard and use set and code in this message.
set:
ods html close;
ods html;
proc sgplot data=sample;
heatmap x=year y=MonthName /
colorresponse=COUNT ;
by InjuryType;
xaxis label="Year" values=(2020 2021 2022 2023 2024);
/* Character Y-axis preserves names; order guaranteed by sorting */
yaxis label="Month of Year" discreteorder=data;
title "Injury Frequency by Year and Month";
run;
Add the DISCRETEX option to the HEATMAP statement:
title "Injury Frequency by Year and Month";
proc sgplot data=sample;
heatmap
x=year y=MonthName /
colorresponse=COUNT
discretex
;
by InjuryType;
xaxis label="Year" values=(2020 2021 2022 2023 2024);
/* Character Y-axis preserves names; order guaranteed by sorting */
yaxis label="Month of Year" discreteorder=data;
run;
An alternative way is using HEATMAPPARM statement:
proc sgplot data=sample; heatmapparm x=year y=MonthName colorresponse=COUNT ; by InjuryType; xaxis label="Year"; /* Character Y-axis preserves names; order guaranteed by sorting */ yaxis label="Month of Year" discreteorder=data; title "Injury Frequency by Year and Month"; run;
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.