<?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 PROC REPORT: EXCEL Output Cell Color based on another Column Value in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256116#M15385</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;have produced an EXCEL output through SAS EG, I want to colour some of the cells YELLOW when another column has a certain value. Below is stripped down version of the&amp;nbsp;data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;OBS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VALUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MATCH&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Smith &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Jones &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Edwards &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Adams &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the&amp;nbsp;EXCEL output looks almost identical to the SAS data set, other than&lt;STRONG&gt; I DO NOT want to the print the MATCH column&lt;/STRONG&gt;.&amp;nbsp;I just need the &lt;STRONG&gt;VALUE&amp;nbsp;&lt;/STRONG&gt;column to be highlighted YELLOW when the &lt;STRONG&gt;MATCH&lt;/STRONG&gt;&amp;nbsp;column contains the letter N.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code so far&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods listing close;
ods tagsets.excelxp file="\\NA1SASFILE1\CVSSandbox\&amp;amp;sysuserid.\AMG\COMPARE\compare.xls" &lt;BR /&gt;                    style = sasweb &lt;BR /&gt;                    options (sheet_interval = "none" sheet_name = "SUBJECT");

	proc report data = compare_t5 nowd
				      style(report)={background=white}
				      style(header)={background=lightblue}
				      style(column)={background=white};

		column observation value match

		/* Standard Columns Columns */
		define observation / display order=internal;
		define value       / display order=internal;
		define match       / noprint;
	
		/* Conditional Formatting */				
		compute value;
			if match = "N" then call define(_col_,'style','style={background=yellow}');
		endcomp;	
	run;

ods tagsets.excelxp close;
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I can not use the format method because my data set contains thousands of records. And not all "Smiths" for example will need to be highlighted yellow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any help would be great.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2016 14:25:05 GMT</pubDate>
    <dc:creator>craig159753</dc:creator>
    <dc:date>2016-03-11T14:25:05Z</dc:date>
    <item>
      <title>PROC REPORT: EXCEL Output Cell Color based on another Column Value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256116#M15385</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;have produced an EXCEL output through SAS EG, I want to colour some of the cells YELLOW when another column has a certain value. Below is stripped down version of the&amp;nbsp;data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;OBS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VALUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MATCH&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Smith &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Jones &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Edwards &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Adams &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the&amp;nbsp;EXCEL output looks almost identical to the SAS data set, other than&lt;STRONG&gt; I DO NOT want to the print the MATCH column&lt;/STRONG&gt;.&amp;nbsp;I just need the &lt;STRONG&gt;VALUE&amp;nbsp;&lt;/STRONG&gt;column to be highlighted YELLOW when the &lt;STRONG&gt;MATCH&lt;/STRONG&gt;&amp;nbsp;column contains the letter N.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code so far&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods listing close;
ods tagsets.excelxp file="\\NA1SASFILE1\CVSSandbox\&amp;amp;sysuserid.\AMG\COMPARE\compare.xls" &lt;BR /&gt;                    style = sasweb &lt;BR /&gt;                    options (sheet_interval = "none" sheet_name = "SUBJECT");

	proc report data = compare_t5 nowd
				      style(report)={background=white}
				      style(header)={background=lightblue}
				      style(column)={background=white};

		column observation value match

		/* Standard Columns Columns */
		define observation / display order=internal;
		define value       / display order=internal;
		define match       / noprint;
	
		/* Conditional Formatting */				
		compute value;
			if match = "N" then call define(_col_,'style','style={background=yellow}');
		endcomp;	
	run;

ods tagsets.excelxp close;
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I can not use the format method because my data set contains thousands of records. And not all "Smiths" for example will need to be highlighted yellow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any help would be great.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 14:25:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256116#M15385</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2016-03-11T14:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: EXCEL Output Cell Color based on another Column Value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256126#M15386</link>
      <description>&lt;P&gt;Simplest way I can see, have a datastep which appears before the proc report. &amp;nbsp;This datastep would flag the data you need to change the color of and assign a color value:&lt;/P&gt;
&lt;PRE&gt;data your_data;
  set your_data;
  if ... then flag=1;
  if ... then flag=2;
...
run;
&lt;/PRE&gt;
&lt;P&gt;Then in your proc report use the flag variable to calculate wether a row should be colored and what color:&lt;/P&gt;
&lt;PRE&gt;proc report data=your_data;
 ...
  compute value;
    if flag=1 then call define(_col_,'style','style={background=yellow}');
    if flag=2 then call define(_col_,'style','style={background=red}');
  endcomp;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Mar 2016 15:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256126#M15386</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-11T15:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: EXCEL Output Cell Color based on another Column Value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256142#M15387</link>
      <description>&lt;P&gt;Remember, PROC REPORT builds each row from left to right, so in your example the value of 'match' is not known when 'value' is computed.&amp;nbsp;To&amp;nbsp;change the style of 'value' based on the value of 'match', the 'match' column must be to the left of the 'value' column.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473631.htm" target="_self"&gt;these examples&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 15:46:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256142#M15387</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2016-03-11T15:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: EXCEL Output Cell Color based on another Column Value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256145#M15388</link>
      <description>&lt;P&gt;Spot on! I realised this earlier, but thanks for solidifying it!!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 15:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/256145#M15388</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2016-03-11T15:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: EXCEL Output Cell Color based on another Column Value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/372093#M18889</link>
      <description />
      <pubDate>Mon, 03 Jul 2017 06:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/372093#M18889</guid>
      <dc:creator>srinidelite</dc:creator>
      <dc:date>2017-07-03T06:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: EXCEL Output Cell Color based on another Column Value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/372424#M18893</link>
      <description>Hi:&lt;BR /&gt;  It's not a great idea to append your new question to an already solved posting. And you've already asked this question in a different posting, haven't you? Isn't this the same question: &lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/PROC-REPORT-compare-col-vs-col/m-p/372100#M47530" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/PROC-REPORT-compare-col-vs-col/m-p/372100#M47530&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;And the same "left-to-right" rule of PROC REPORT applies. &lt;BR /&gt;&lt;BR /&gt;Please go back and read the other posting. The correct answer has been posted several times.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Sat, 01 Jul 2017 15:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/372424#M18893</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-07-01T15:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT: EXCEL Output Cell Color based on another Column Value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/372656#M18897</link>
      <description>&lt;P&gt;Apologies &amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes I will Move this question back to the mentioned&amp;nbsp;post ! Thanks again for regulating&amp;nbsp;me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 06:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-EXCEL-Output-Cell-Color-based-on-another-Column/m-p/372656#M18897</guid>
      <dc:creator>srinidelite</dc:creator>
      <dc:date>2017-07-03T06:29:43Z</dc:date>
    </item>
  </channel>
</rss>

