<?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 colours in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-report-colours/m-p/601331#M173919</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am using proc report and I want to create colors to cells depends on their values related to UCL1&amp;nbsp; and UCL2 .&lt;/P&gt;
&lt;P&gt;I have 2 questions please:&lt;/P&gt;
&lt;P&gt;1-Why do I get all cells of X1909,X1908mX1907,X1906 with red color??&lt;/P&gt;
&lt;P&gt;Foe example:&lt;/P&gt;
&lt;P&gt;For X1909 I should get all cells with no color because none of them is higher then UCL1 value or UCL2 value&lt;/P&gt;
&lt;P&gt;2-There is a code that repeat many times.Is there a clever way to write it in short code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawtbl;
  input (X1909 X1908 X1907 X1906 UCL1 UCL2) (:percent.);
  format X1909 X1908 X1907 X1906 UCL1 UCL2 percent7.2;
  cards;
4% 3% 6% 5.10% 5% 5.20%
3% 2% 2% 4.60% 4.50% 4.90%
5% 5% 5% 5% 7% 8%
;
run;

  proc report data=rawtbl nowd;
     column X1909 X1908 X1907 X1906 UCL1 UCL2;
     define X1909 / display;
     define X1908 / display;
     define X1907 / display;
     define X1906 / display;
     define UCL1 / display;
     define UCL2 / display;
compute X1909;
     if X1909&amp;gt;UCL1 and X1909&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1909&amp;gt;UCL1 and X1909&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1909&amp;lt;=UCL1 and X1909&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;

compute X1908;
     if X1908&amp;gt;UCL1 and X1908&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1908&amp;gt;UCL1 and X1908&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1908&amp;lt;=UCL1 and X1908&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;


compute X1907;
     if X1907&amp;gt;UCL1 and X1907&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1907&amp;gt;UCL1 and X1907&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1907&amp;lt;=UCL1 and X1907&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;


compute X1906;
     if X1906&amp;gt;UCL1 and X1906&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1906&amp;gt;UCL1 and X1906&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1906&amp;lt;=UCL1 and X1906&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;
   run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please not that I have learned from example code&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/23/353.html" target="_blank"&gt;http://support.sas.com/kb/23/353.html&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
  proc report data=sashelp.class nowd;
     column name age sex height weight;
     define name / display;
     define age / display;
     define sex / order;
     define height / sum;
     define weight / sum;
   compute age;
     if age &amp;lt; 13 then call define(_col_,"style","style={background=red}");
   endcomp;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Nov 2019 10:21:36 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2019-11-04T10:21:36Z</dc:date>
    <item>
      <title>proc report colours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-colours/m-p/601331#M173919</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am using proc report and I want to create colors to cells depends on their values related to UCL1&amp;nbsp; and UCL2 .&lt;/P&gt;
&lt;P&gt;I have 2 questions please:&lt;/P&gt;
&lt;P&gt;1-Why do I get all cells of X1909,X1908mX1907,X1906 with red color??&lt;/P&gt;
&lt;P&gt;Foe example:&lt;/P&gt;
&lt;P&gt;For X1909 I should get all cells with no color because none of them is higher then UCL1 value or UCL2 value&lt;/P&gt;
&lt;P&gt;2-There is a code that repeat many times.Is there a clever way to write it in short code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawtbl;
  input (X1909 X1908 X1907 X1906 UCL1 UCL2) (:percent.);
  format X1909 X1908 X1907 X1906 UCL1 UCL2 percent7.2;
  cards;
4% 3% 6% 5.10% 5% 5.20%
3% 2% 2% 4.60% 4.50% 4.90%
5% 5% 5% 5% 7% 8%
;
run;

  proc report data=rawtbl nowd;
     column X1909 X1908 X1907 X1906 UCL1 UCL2;
     define X1909 / display;
     define X1908 / display;
     define X1907 / display;
     define X1906 / display;
     define UCL1 / display;
     define UCL2 / display;
compute X1909;
     if X1909&amp;gt;UCL1 and X1909&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1909&amp;gt;UCL1 and X1909&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1909&amp;lt;=UCL1 and X1909&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;

compute X1908;
     if X1908&amp;gt;UCL1 and X1908&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1908&amp;gt;UCL1 and X1908&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1908&amp;lt;=UCL1 and X1908&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;


compute X1907;
     if X1907&amp;gt;UCL1 and X1907&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1907&amp;gt;UCL1 and X1907&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1907&amp;lt;=UCL1 and X1907&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;


compute X1906;
     if X1906&amp;gt;UCL1 and X1906&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
	 else if X1906&amp;gt;UCL1 and X1906&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
	 else if X1906&amp;lt;=UCL1 and X1906&amp;lt;=UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;
   run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please not that I have learned from example code&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/23/353.html" target="_blank"&gt;http://support.sas.com/kb/23/353.html&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
  proc report data=sashelp.class nowd;
     column name age sex height weight;
     define name / display;
     define age / display;
     define sex / order;
     define height / sum;
     define weight / sum;
   compute age;
     if age &amp;lt; 13 then call define(_col_,"style","style={background=red}");
   endcomp;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Nov 2019 10:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-colours/m-p/601331#M173919</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-11-04T10:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: proc report colours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-colours/m-p/601355#M173932</link>
      <description>&lt;P&gt;PROC REPORT calculated it from LEFT to RIGHT. Try use the last column UCL2 to compute:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;compute&lt;/SPAN&gt; UCL2;  
     &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; X1909&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;UCL1 and X1909&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;UCL2 &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; call &lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;('X1909'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style={background=red}"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
	 &lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; X1909&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;UCL1 and X1909&lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt;UCL2 &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; call &lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;('X1909'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style={background=lightred}"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
	 &lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; X1909&lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt;UCL1 and X1909&lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt;UCL2 &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; call &lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;('X1909'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"style={background=pink}"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;endcomp&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&amp;nbsp;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 12:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-colours/m-p/601355#M173932</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-11-04T12:27:20Z</dc:date>
    </item>
  </channel>
</rss>

