<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SAS Heat Map in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982456#M379335</link>
    <description>&lt;P&gt;Let this paper be an inspiration:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paper SAS4341-2016&lt;/P&gt;
&lt;P&gt;Graph A Million with the SGPLOT Procedure&lt;/P&gt;
&lt;P&gt;Prashant Hebbar and Sanjay Matange, SAS Institute Inc.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings16/SAS4341-2016.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings16/SAS4341-2016.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's using the&amp;nbsp;HEATMAP statement on numerous occasions.&lt;/P&gt;
&lt;P&gt;In the third maintenance release of SAS 9.4 (SAS 9.4 M3), the SGPLOT procedure supports a HEATMAP statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jan 2026 22:00:44 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2026-01-26T22:00:44Z</dc:date>
    <item>
      <title>SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982451#M379331</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a set containing 2 types of injuries (coded 0 &amp;amp; 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.&lt;/P&gt;
&lt;P&gt;Is that doable? If so, what would be the code?&lt;/P&gt;
&lt;P&gt;This is a sample of my set:&lt;/P&gt;
&lt;DIV&gt;data sample (compress=binary);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INPUT record_id Injury1 Injury2 year InjuryDateTime:DATETIME20.;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;nbsp; format InjuryDateTime datetime20.;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DATALINES;&lt;/DIV&gt;
&lt;DIV&gt;2497728 1 0 2021 27APR2021:15:00:00&lt;/DIV&gt;
&lt;DIV&gt;2590114 1 0 2023 25NOV2023:20:20:00&lt;/DIV&gt;
&lt;DIV&gt;2590765 1 0 2023 18AUG2023:17:20:00&lt;/DIV&gt;
&lt;DIV&gt;2590842 1 0 2023 06JUL2023:10:00:00&lt;/DIV&gt;
&lt;DIV&gt;2591821 1 0 2023 16AUG2023:18:36:00&lt;/DIV&gt;
&lt;DIV&gt;2591839 1 0 2023 31JUL2023:14:46:00&lt;/DIV&gt;
&lt;DIV&gt;2591860 1 0 2023 04JUL2023:17:59:00&lt;/DIV&gt;
&lt;DIV&gt;2599177 1 0 2023 01OCT2023:18:00:00&lt;/DIV&gt;
&lt;DIV&gt;2599305 1 0 2023 01OCT2023:14:00:00&lt;/DIV&gt;
&lt;DIV&gt;2600027 1 0 2023 22OCT2023:19:00:00&lt;/DIV&gt;
&lt;DIV&gt;2600280 1 0 2023 22OCT2023:19:00:00&lt;/DIV&gt;
&lt;DIV&gt;2502863 0 1 2021 13NOV2021:13:00:00&lt;/DIV&gt;
&lt;DIV&gt;2507650 0 1 2021 24SEP2021:16:25:00&lt;/DIV&gt;
&lt;DIV&gt;2507987 0 1 2021 12AUG2021:14:21:00&lt;/DIV&gt;
&lt;DIV&gt;2508819 0 1 2021 07MAY2021:18:15:00&lt;/DIV&gt;
&lt;DIV&gt;2516706 0 1 2021 21SEP2021:09:07:00&lt;/DIV&gt;
&lt;DIV&gt;2516721 0 1 2021 20SEP2021:21:00:00&lt;/DIV&gt;
&lt;DIV&gt;2516869 0 1 2021 05SEP2021:09:40:00&lt;/DIV&gt;
&lt;DIV&gt;2517049 0 1 2021 14AUG2021:08:18:00&lt;/DIV&gt;
&lt;DIV&gt;2517142 0 1 2021 05AUG2021:22:00:00&lt;/DIV&gt;
&lt;DIV&gt;2517187 0 1 2021 31JUL2021:00:40:00&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; ;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; RUN;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thank you!&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Jan 2026 21:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982451#M379331</guid>
      <dc:creator>Ihsan-Mahdi</dc:creator>
      <dc:date>2026-01-26T21:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982456#M379335</link>
      <description>&lt;P&gt;Let this paper be an inspiration:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paper SAS4341-2016&lt;/P&gt;
&lt;P&gt;Graph A Million with the SGPLOT Procedure&lt;/P&gt;
&lt;P&gt;Prashant Hebbar and Sanjay Matange, SAS Institute Inc.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings16/SAS4341-2016.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings16/SAS4341-2016.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's using the&amp;nbsp;HEATMAP statement on numerous occasions.&lt;/P&gt;
&lt;P&gt;In the third maintenance release of SAS 9.4 (SAS 9.4 M3), the SGPLOT procedure supports a HEATMAP statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2026 22:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982456#M379335</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-01-26T22:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982462#M379338</link>
      <description>&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IhsanMahdi_3-1769466053936.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112787iB42B6B994358BA15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IhsanMahdi_3-1769466053936.png" alt="IhsanMahdi_3-1769466053936.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2026 22:21:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982462#M379338</guid>
      <dc:creator>Ihsan-Mahdi</dc:creator>
      <dc:date>2026-01-26T22:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982464#M379339</link>
      <description>&lt;P&gt;Did you try something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jan 2026 22:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982464#M379339</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-26T22:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982467#M379340</link>
      <description>&lt;P&gt;I did, but the graphs comes up weird:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IhsanMahdi_0-1769468774376.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112788iB65A823CEBD7E10E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IhsanMahdi_0-1769468774376.png" alt="IhsanMahdi_0-1769468774376.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I was hoping for Y axis labels of 0-23 and X axis labels of 1-7&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2026 23:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982467#M379340</guid>
      <dc:creator>Ihsan-Mahdi</dc:creator>
      <dc:date>2026-01-26T23:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982472#M379344</link>
      <description>&lt;UL&gt;
&lt;LI&gt;You can try&amp;nbsp;&lt;A tabindex="0" href="https://go.documentation.sas.com/doc/en/vdmmlcdc/8.1/grstatproc/n0w12m4cn1j5c6n12ak64u1rys4w.htm#p1o4dpuw4q6ugmn17zxt6y8rbkea" target="_blank"&gt;DISCRETEX&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A tabindex="0" href="https://go.documentation.sas.com/doc/en/vdmmlcdc/8.1/grstatproc/n0w12m4cn1j5c6n12ak64u1rys4w.htm#n0dchhx7lcfhgxn1pcrxoadb507x" target="_blank"&gt;DISCRETEY&lt;/A&gt;&amp;nbsp;options on the heatmap statement.&lt;/LI&gt;
&lt;LI&gt;You can try&amp;nbsp;&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;min=&lt;/CODE&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;max=&lt;/CODE&gt;&lt;SPAN&gt;, or&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;values=(list)&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;discreteorder=&lt;/CODE&gt; within the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;xaxis&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;yaxis&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;statements to control the axes ranges better.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;You can also customize Ticks and Labels (&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;tickvalueattrs=&lt;/CODE&gt;&amp;nbsp;and&amp;nbsp;&lt;CODE class="o8j0Mc" dir="ltr" data-processed="true"&gt;display=&lt;/CODE&gt;&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Ciao,&lt;BR /&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2026 09:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982472#M379344</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-01-27T09:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982543#M379353</link>
      <description>&lt;PRE&gt;proc format;
value fmt
2='Monday'
3='Tuesday'
4='Wednesday'
5='Thursday'
6='Firday'
7='Saturday'
&lt;STRONG&gt;8='Sunday'&lt;/STRONG&gt;
;
run;

data sample (compress=binary);
      INPUT record_id Injury1 Injury2 year InjuryDateTime:DATETIME20.; 
	  weekday=weekday(datepart(InjuryDateTime));
	  &lt;STRONG&gt;if weekday=1 then weekday=8;   /*To make x value from Mon to Sun*/&lt;/STRONG&gt;
	  hour=hour(timepart(InjuryDateTime));
  format InjuryDateTime datetime20. weekday fmt.;
      DATALINES;
2497728 1 0 2021 27APR2021:15:00:00
2590114 1 0 2023 25NOV2023:20:20:00
2590765 1 0 2023 18AUG2023:17:20:00
2590842 1 0 2023 06JUL2023:10:00:00
2591821 1 0 2023 16AUG2023:18:36:00
2591839 1 0 2023 31JUL2023:14:46:00
2591860 1 0 2023 04JUL2023:17:59:00
2599177 1 0 2023 01OCT2023:18:00:00
2599305 1 0 2023 01OCT2023:14:00:00
2600027 1 0 2023 22OCT2023:19:00:00
2600280 1 0 2023 22OCT2023:19:00:00
2502863 0 1 2021 13NOV2021:13:00:00
2507650 0 1 2021 24SEP2021:16:25:00
2507987 0 1 2021 12AUG2021:14:21:00
2508819 0 1 2021 07MAY2021:18:15:00
2516706 0 1 2021 21SEP2021:09:07:00
2516721 0 1 2021 20SEP2021:21:00:00
2516869 0 1 2021 05SEP2021:09:40:00
2517049 0 1 2021 14AUG2021:08:18:00
2517142 0 1 2021 05AUG2021:22:00:00
2517187 0 1 2021 31JUL2021:00:40:00
;



proc freq data=sample noprint;
table weekday*hour/out=freq1;
run;

proc sgplot data=freq1 noautolegend;
   heatmapparm x=weekday y=hour colorresponse=count / colormodel=(CXEDF8E9 CXC7E9C0 CXA1D99B CX74C476 CX31A354 CX006D2C );
   xaxis integer values=(2 to 8 by 1) valueshint;
   yaxis integer values=(0 to 24 by 1) valueshint;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1769759905397.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112892i54D6748C7DC82F31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1769759905397.png" alt="Ksharp_0-1769759905397.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2026 07:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982543#M379353</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-01-30T07:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982696#M379371</link>
      <description>&lt;P&gt;Thank you so much and my apologies for the delayed reply. This worked great!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2026 22:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982696#M379371</guid>
      <dc:creator>Ihsan-Mahdi</dc:creator>
      <dc:date>2026-01-29T22:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Heat Map</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982703#M379373</link>
      <description>&lt;P&gt;Sorry. I just realize a BIG/SEVERITY issue.&lt;/P&gt;
&lt;P&gt;Since SAS take Sunday as start of a week, the weak day of Sunday is 1, therefore the PROC FORMAT should be consist with it :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format;
value fmt
2='Monday'
3='Tuesday'
4='Wednesday'
5='Thursday'
6='Firday'
7='Saturday'
&lt;STRONG&gt;1='Sunday'&lt;/STRONG&gt;
;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jan 2026 07:51:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Heat-Map/m-p/982703#M379373</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-01-30T07:51:23Z</dc:date>
    </item>
  </channel>
</rss>

