<?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: Help with Color code for cell in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521588#M141540</link>
    <description>&lt;P&gt;this may help you I have copied it from another solution&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings11/290-2011.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings11/290-2011.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Dec 2018 17:56:12 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2018-12-14T17:56:12Z</dc:date>
    <item>
      <title>Help with Color code for cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521583#M141538</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to put color code on my column Name and it doesn't work correctly even though it pain color correctly if I paint other column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you help me with the logic here?&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;P&gt;HHCFX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input name $ v1 v2 v3;
datalines;
a 1 2 1
a 3 4 1
b 4 5 3
b 3 5 8
b 1 1 5
c 1 1 5
c 0 0 5
run;


*USING V2 or V3 in COMPUTE work correctly;

proc report data=a nowd;
		column name v1 v2 v3;
		define name/display;
		define v1/display;
		define v2/display;
		define v3/display;

compute &lt;STRONG&gt;v3&lt;/STRONG&gt;  ;
			if name^=lag(name) then call define(_col_,"style","style={background=BIYG}");
			else
			if v2 &amp;lt;3 then call define(_col_,"style","style={background=YELLOW}");
			endcomp;
run;

*USING NAME  in COMPUTE --&amp;gt; NOT correctly;

proc report data=a nowd;
		column name v1 v2 v3;
		define name/display;
		define v1/display;
		define v2/display;
		define v3/display;

compute &lt;STRONG&gt;NAME&lt;/STRONG&gt;  ;
			if name^=lag(name) then call define(_col_,"style","style={background=BIYG}");
			else
			if v2 &amp;lt;3 then call define(_col_,"style","style={background=YELLOW}");
			endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Dec 2018 17:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521583#M141538</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-12-14T17:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Color code for cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521588#M141540</link>
      <description>&lt;P&gt;this may help you I have copied it from another solution&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings11/290-2011.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings11/290-2011.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 17:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521588#M141540</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-12-14T17:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Color code for cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521608#M141543</link>
      <description>&lt;P&gt;Proc report builds a table from left to right. You cant reference any variable that appears to the right of the current column in a calculation.&lt;/P&gt;
&lt;P&gt;So&amp;nbsp; since both V2 and V3 appear to the right of Name in column heading they are not available to use in computation for the NAME cells.&lt;/P&gt;
&lt;PRE&gt;compute NAME  ;
	if name^=lag(name) then call define(_col_,"style","style={background=BIYG}");
	else
	if v2 &amp;lt;3 then call define(_col_,"style","style={background=YELLOW}");
endcomp;
&lt;/PRE&gt;
&lt;P&gt;One approach would be add a variable that indicates the v2&amp;lt;v3 status, include it BEFORE name on the column statement and set it to NOPRINT so it does not appear in the output but is available for use in the NAME compute block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 18:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521608#M141543</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-14T18:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Color code for cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521609#M141544</link>
      <description>&lt;P&gt;oh I see.&lt;/P&gt;
&lt;P&gt;Thanks a lot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 19:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Color-code-for-cell/m-p/521609#M141544</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-12-14T19:04:51Z</dc:date>
    </item>
  </channel>
</rss>

