<?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: using proc report to make excel heatmap in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-proc-report-to-make-excel-heatmap/m-p/828725#M327369</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I would like to shade the "run" cells for each trial red if there is no "run" value for a trial. And shade cells green if there is&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;at least one&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;value for "run" within each trial.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I don't think this can be done directly in PROC REPORT, because PROC REPORT (as far as I know) doesn't know about the other values that appear in the trial on other rows of the data set. Now, if you create a new variable in a DATA step which is numeric and has value 0 when run is missing and a value of 1 when run is Y, I think you could do this in PROC REPORT, using the sum of these 0/1 values, if the sum is zero then red and if the sum is greater than 0 then green.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Aug 2022 16:57:52 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-08-15T16:57:52Z</dc:date>
    <item>
      <title>using proc report to make excel heatmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-report-to-make-excel-heatmap/m-p/828702#M327358</link>
      <description>&lt;P&gt;Hi, I am creating a heat map in excel based on the "have" data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to shade the "run" cells for each trial red if there is no "run" value for a trial. And shade cells green if there is &lt;U&gt;at least one&lt;/U&gt; value for "run" within each trial.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So based on the data below, "trial" 002 would have all "run" values shaded red in excel.&lt;/P&gt;
&lt;P&gt;All other trials would have green "run" values in excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%let outfile=; /*add excel path here*/
filename _xlsx_ "&amp;amp;outfile.";

data have;
input trial : $3. environment : $4. run $1.;
datalines;
001 PROD Y
001 TEST        
002 TEST
002 PROD  
003 PROD Y
004 TEST Y
004 PROD Y
;
/*ODS excel start*/
ods excel file=_xlsx_
		  style=statistical;
		  
ods excel options(frozen_headers="1"
    			  autofilter="all"
    			  flow="table"
    			  sheet_name="Blueprint");

proc report data=have nowd;
	columns trial environment run;
	define trial / order;
	define environment / display;
	define run / display;
run;

/*ODS excel end*/
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Aug 2022 15:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-report-to-make-excel-heatmap/m-p/828702#M327358</guid>
      <dc:creator>kalbo</dc:creator>
      <dc:date>2022-08-15T15:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: using proc report to make excel heatmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-report-to-make-excel-heatmap/m-p/828725#M327369</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I would like to shade the "run" cells for each trial red if there is no "run" value for a trial. And shade cells green if there is&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;at least one&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;value for "run" within each trial.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I don't think this can be done directly in PROC REPORT, because PROC REPORT (as far as I know) doesn't know about the other values that appear in the trial on other rows of the data set. Now, if you create a new variable in a DATA step which is numeric and has value 0 when run is missing and a value of 1 when run is Y, I think you could do this in PROC REPORT, using the sum of these 0/1 values, if the sum is zero then red and if the sum is greater than 0 then green.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 16:57:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-report-to-make-excel-heatmap/m-p/828725#M327369</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-08-15T16:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: using proc report to make excel heatmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-report-to-make-excel-heatmap/m-p/828831#M327432</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let outfile=c:\temp\temp.xlsx ; /*add excel path here*/
filename _xlsx_ "&amp;amp;outfile.";

data have;
input trial : $3. environment : $4. run $1.;
datalines;
001 PROD Y
001 TEST        
002 TEST
002 PROD  
003 PROD Y
004 TEST Y
004 PROD Y
;

proc sql;
create table temp as
select *,case when n(run) then 'green' else 'red ' end as color
 from have 
  group by trial
    order by 1,2;
quit;
/*ODS excel start*/
ods excel file=_xlsx_
    style=statistical;
    
ods excel options(frozen_headers="1"
         autofilter="all"
         flow="table"
         sheet_name="Blueprint");

proc report data=temp nowd;
 columns trial environment run color;
 define trial / order;
 define environment / display;
 define run / display;
 define color /noprint;
 compute color;
      call define(_row_,'style',cats('style={background=',color,'}'));
 endcomp;
run;

/*ODS excel end*/
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1660653130681.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74463iFC47907CCBECF501/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1660653130681.png" alt="Ksharp_0-1660653130681.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 12:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-report-to-make-excel-heatmap/m-p/828831#M327432</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-08-16T12:32:08Z</dc:date>
    </item>
  </channel>
</rss>

