Hello,
I have a set containing 2 types of injuries (coded 0 & 1), and a date/time field. I'm interested in creating a heat map showing the frequency of occurrence of each injury type by time of day in a week, and another map showing frequency of occurrence by month of year.
Is that doable? If so, what would be the code?
This is a sample of my set:
Let this paper be an inspiration:
Paper SAS4341-2016
Graph A Million with the SGPLOT Procedure
Prashant Hebbar and Sanjay Matange, SAS Institute Inc.
https://support.sas.com/resources/papers/proceedings16/SAS4341-2016.pdf
It's using the HEATMAP statement on numerous occasions.
In the third maintenance release of SAS 9.4 (SAS 9.4 M3), the SGPLOT procedure supports a HEATMAP statement.
Koen
Thank you for responding. The referenced paper doesn't seem to contain a map similar to what I want, which would be something like this:
Did you try something like this?
data for_plot;
set sample;
day=weekday(datepart(InjuryDateTime));
hour=hour(InjuryDateTime);
run;
proc sgplot;
heatmap x=day y=hour / freq=Injury1;
run;
proc sgplot;
heatmap x=day y=hour / freq=Injury2;
run;
I did, but the graphs comes up weird:
I was hoping for Y axis labels of 0-23 and X axis labels of 1-7
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.