<?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: Proc report - above, below and at diagonal color in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/538250#M148158</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for different highlight logic you need distinct compute statements.&lt;/P&gt;&lt;P&gt;If there is no change in the highlight logic accross the columns&amp;nbsp;you can&amp;nbsp;highlight the whole _row_:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp; set sashelp.cars; row_n = _N_; if _N_ &amp;lt;12; run;

proc report data=temp NOWD ;
	column row_n make length;
	DEFINE row_n / '' order ORDER=data;
 	DEFINE make  / '' order ORDER=data;
	COMPUTE row_n;  
		IF row_n eq 4 then CALL DEFINE(_row_,'style','style={background=yellow}');
	ENDCOMP;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;If this doesn't answer your question maybe you could post an example of what you are trying to reach&lt;/P&gt;</description>
    <pubDate>Mon, 25 Feb 2019 12:48:08 GMT</pubDate>
    <dc:creator>Oligolas</dc:creator>
    <dc:date>2019-02-25T12:48:08Z</dc:date>
    <item>
      <title>Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537031#M147634</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found certain examples for more complicated cases of color coding but could not reproduce the result for a simpler case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a NxN table and I want the cells to have different color depending if they are above, below or at the diagonal.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying with solution of the type:&lt;/P&gt;&lt;PRE&gt;proc report data=have;
	column col1 col2;
		COMPUTE before;
			IF _row_ / _col_ = 1 THEN DO;
				CALL DEFINE(_col_,'style','style={background=atDiag}');
			END;
			IF _row_ / _col_ &amp;gt; 1 THEN DO;
				CALL DEFINE(_col_,'style','style={background=beDiag}');
			END;
			IF _row_ / _col_ &amp;lt; 1 THEN DO;
				CALL DEFINE(_col_,'style','style={background=abDiag}');
			END;
		ENDCOMP;
run;&lt;/PRE&gt;&lt;P&gt;However even a simpler cell coloring doesn't work:&lt;/P&gt;&lt;PRE&gt;proc report data=sashelp.cars;
	column model weight;
		COMPUTE before;
			IF _row_ = 2 and _col_ = 2 THEN DO;
				CALL DEFINE(_col_,'style','style={background=yellow}');
			END;
		ENDCOMP;
run;&lt;/PRE&gt;&lt;P&gt;Is there a simple way to achieve this without using additional numbers and just the row and col number?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 10:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537031#M147634</guid>
      <dc:creator>KonstantinVasil</dc:creator>
      <dc:date>2019-02-20T10:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537332#M147771</link>
      <description>&lt;P&gt;_row_ and _col_ are only known by the call define Statement(&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473624.htm" target="_blank" rel="noopener"&gt;link&lt;/A&gt;) you can not perform a Logical Operation on them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this way it works:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.cars;
   where index(model,'A4');
	column model weight;
		COMPUTE weight;
         count+1;
			IF count = 2 THEN DO;
				CALL DEFINE(_col_,'style','style={background=yellow}');
			END;
		ENDCOMP;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Feb 2019 07:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537332#M147771</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2019-02-21T07:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537342#M147779</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you but with this solution I can only color along the column &amp;lt;weight&amp;gt;. I would like to color across the whole table and every column and row with three different colors for above, below or at the diagonal.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 09:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537342#M147779</guid>
      <dc:creator>KonstantinVasil</dc:creator>
      <dc:date>2019-02-21T09:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537601#M147883</link>
      <description>&lt;P&gt;Then apply any logic for any row or column as presented in the sample and it will work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 06:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537601#M147883</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2019-02-22T06:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537604#M147884</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot_15.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27342i9A8E3747B936BC6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot_15.jpg" alt="screenshot_15.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 06:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537604#M147884</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2019-02-22T06:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537617#M147889</link>
      <description>&lt;P&gt;Isn't there a simple way to specify COMPUTE for each column? Instead of having repeating compute statements or writing out all columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I tried making a row_number variable as an order variable and tried to execute COMPUTE after&amp;nbsp;row_number; expecting to conduct the computation after each row and for all columns - but it didnt work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data temp; set sashelp.cars; row_n = _N_; if _N_ &amp;lt;12; run;

proc report data=temp NOWD ;
	column row_n make length;
	DEFINE row_n / '' order  ORDER=data;
 	DEFINE make / ''  order ORDER=data;
	COMPUTE after row_n;  /*only works if the compute is on make*/
		IF row_n = 4 and _col_ = 2 then CALL DEFINE(_col_,'style','style={background=yellow}');
	ENDCOMP;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 09:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/537617#M147889</guid>
      <dc:creator>KonstantinVasil</dc:creator>
      <dc:date>2019-02-22T09:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/538250#M148158</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for different highlight logic you need distinct compute statements.&lt;/P&gt;&lt;P&gt;If there is no change in the highlight logic accross the columns&amp;nbsp;you can&amp;nbsp;highlight the whole _row_:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp; set sashelp.cars; row_n = _N_; if _N_ &amp;lt;12; run;

proc report data=temp NOWD ;
	column row_n make length;
	DEFINE row_n / '' order ORDER=data;
 	DEFINE make  / '' order ORDER=data;
	COMPUTE row_n;  
		IF row_n eq 4 then CALL DEFINE(_row_,'style','style={background=yellow}');
	ENDCOMP;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;If this doesn't answer your question maybe you could post an example of what you are trying to reach&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 12:48:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/538250#M148158</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2019-02-25T12:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - above, below and at diagonal color</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/538276#M148164</link>
      <description>&lt;P&gt;Thank you for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found a solution using a macro that iterates through all variables which columns should be colored. Then in creates a compute block for each variable. The coloring is also specific depending the variable order, in order to color depending on the location relative to the diagonal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro color_migration(var_list);
	%do i=1 %to %sysfunc(countw(&amp;amp;var_list.));
		%let var = %scan(&amp;amp;var_list., &amp;amp;i.);	
		COMPUTE  &amp;amp;var.;
			IF order_var=&amp;amp;i. THEN CALL DEFINE(_col_,'style','style={background=cxFDE9D9}');
			else if order_var&amp;gt;&amp;amp;i. and order_var &amp;lt;28  THEN CALL DEFINE(_col_,'style','style={background=cxD8E4BC}');
			else if order_var &amp;lt;&amp;amp;i. and order_var &amp;gt;0 THEN CALL DEFINE(_col_,'style','style={background=cxE6B8B7}');
		ENDCOMP;
	%end;
%mend color_migration;

	proc report data= temp ;
	  column ( "Test"  order_var  Vars: );
	  define order_var / noprint order order=data ;
	  %color_migration(var_list=&amp;amp;var_list.);
	run; &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 14:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-above-below-and-at-diagonal-color/m-p/538276#M148164</guid>
      <dc:creator>KonstantinVasil</dc:creator>
      <dc:date>2019-02-25T14:32:53Z</dc:date>
    </item>
  </channel>
</rss>

