<?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 with color coding in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398901#M96543</link>
    <description>&lt;P&gt;A partial answer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you have ACROSS variables in PROC REPORT, you have to refer to the columns of interest by the column number, such as this example, which would color code your column 3:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;call define("_c3_",'style','style={background=ever60f.}');&lt;/PRE&gt;
&lt;P&gt;Also, note that I have used a format to determine the background color. I don't know if that is necessary in your case or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, the variable ABOVE is mentioned in your PROC REPORT, but does not exist. Even if you remove the &lt;FONT face="courier new,courier"&gt;and above&amp;gt;0&lt;/FONT&gt; from the code, you still get the warning in the SASLOG that FLG is uninitialized. I suspect to use FLG this way, you'd need to move it to the left of the parenthesis in the COLUMN statement, but that screws up the table organization.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I'm not sure you can get this to work, but those are some things to try.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2017 18:54:43 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2017-09-26T18:54:43Z</dc:date>
    <item>
      <title>proc report with color coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398884#M96536</link>
      <description>&lt;DIV class="lia-message-heading lia-component-message-header"&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-standard"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-left"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-left"&gt;&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;I want to color coding "Value" column. Why the blow code does not work?&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;data a;&lt;BR /&gt;input TRT $ Visno $ Param $ value flg;&lt;BR /&gt;datalines;&lt;BR /&gt;TRT1 v1 A 8 1&lt;BR /&gt;TRT1 v1 B 6 0&lt;BR /&gt;TRT1 v1 C 5 2&lt;BR /&gt;TRT1 v2 A 6 0&lt;BR /&gt;TRT1 v2 B 7 0&lt;BR /&gt;TRT1 v3 C 8 0&lt;BR /&gt;TRT2 v1 A 3 1&lt;BR /&gt;TRT2 v1 B 7 3&lt;BR /&gt;TRT2 v1 C 5 2&lt;BR /&gt;TRT2 v2 A 10 0&lt;BR /&gt;TRT2 v2 B 6 1&lt;BR /&gt;TRT2 v3 C 10 0&lt;BR /&gt;TRT3 v1 A 10 2&lt;BR /&gt;TRT3 v1 B 16 1&lt;BR /&gt;TRT3 v1 C 18 2&lt;BR /&gt;TRT3 v2 A 14 1&lt;BR /&gt;TRT3 v2 B 11 2&lt;BR /&gt;TRT3 v3 C 15 1&lt;BR /&gt;;&lt;BR /&gt;proc report data=a NOCOMPLETECOLS;&lt;BR /&gt;column trt visno, (param, (flg value ));&lt;/P&gt;&lt;P&gt;define trt / group;&lt;BR /&gt;define visno / across;&lt;BR /&gt;define param / across;&lt;BR /&gt;define flg / display;&lt;/P&gt;&lt;P&gt;compute value;&lt;BR /&gt;if flg=1 and above&amp;gt;0 then call define(_col_,"style","style=[background=yellow]");&lt;BR /&gt;else if flg=2 then call define(_col_,"style","style=[background=orange]");&lt;BR /&gt;else if flg=3 then call define(_col_,"style","style=[background=red]");&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 26 Sep 2017 18:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398884#M96536</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2017-09-26T18:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: proc report with color coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398901#M96543</link>
      <description>&lt;P&gt;A partial answer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you have ACROSS variables in PROC REPORT, you have to refer to the columns of interest by the column number, such as this example, which would color code your column 3:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;call define("_c3_",'style','style={background=ever60f.}');&lt;/PRE&gt;
&lt;P&gt;Also, note that I have used a format to determine the background color. I don't know if that is necessary in your case or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, the variable ABOVE is mentioned in your PROC REPORT, but does not exist. Even if you remove the &lt;FONT face="courier new,courier"&gt;and above&amp;gt;0&lt;/FONT&gt; from the code, you still get the warning in the SASLOG that FLG is uninitialized. I suspect to use FLG this way, you'd need to move it to the left of the parenthesis in the COLUMN statement, but that screws up the table organization.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I'm not sure you can get this to work, but those are some things to try.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 18:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398901#M96543</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-09-26T18:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc report with color coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398909#M96546</link>
      <description>&lt;P&gt;Sorry, the 'above' should be removed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below code still does not work. and in the log it shows "NOTE: Variable flg is uninitialized. "&amp;nbsp;&lt;/P&gt;&lt;P&gt;why ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I move the flg varible&amp;nbsp;&lt;SPAN&gt;to the left of the parenthesis, how can I use across to display flag variable?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can transpose data into several columns, however it will make the code&amp;nbsp;some longer and complicated.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=a NOCOMPLETECOLS;&lt;BR /&gt;column trt visno, (param, (flg value ));&lt;BR /&gt;define trt / group;&lt;BR /&gt;define visno / across;&lt;BR /&gt;define param / across;&lt;BR /&gt;define flg / display;&lt;BR /&gt;compute value;&lt;BR /&gt;if flg=1 then call define('_c3_',"style","style=[background=yellow]");&lt;BR /&gt;else if flg=2 then call define('_c3_',"style","style=[background=orange]");&lt;BR /&gt;else if flg=3 then call define('_c3_',"style","style=[background=red]");&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 18:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398909#M96546</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2017-09-26T18:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc report with color coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398911#M96547</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;If I move the flg varible&amp;nbsp;&lt;SPAN&gt;to the left of the parenthesis, how can I use across to display flag variable?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Probably you can't. You might create a duplicate variable flg1 that has the same values as flg and move that to the left of the parentheses, and use flg1 to determine the colors, but I think that destroys the table organization.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As I said, I don't know if you can make this work in PROC REPORT or not.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 18:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398911#M96547</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-09-26T18:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc report with color coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398922#M96553</link>
      <description>&lt;P&gt;You are correct. I tried to move the flg into a different place, which resulted a strange output.&lt;/P&gt;&lt;P&gt;Hopefull someone can figure this issue out.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/398922#M96553</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2017-09-26T19:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: proc report with color coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/399245#M96684</link>
      <description>&lt;PRE&gt;
use option OUT= to check the real variable name you should refer to.




data a;
input TRT $ Visno $ Param $ value flg;
datalines;
TRT1 v1 A 8 1
TRT1 v1 B 6 0
TRT1 v1 C 5 2
TRT1 v2 A 6 0
TRT1 v2 B 7 0
TRT1 v3 C 8 0
TRT2 v1 A 3 1
TRT2 v1 B 7 3
TRT2 v1 C 5 2
TRT2 v2 A 10 0
TRT2 v2 B 6 1
TRT2 v3 C 10 0
TRT3 v1 A 10 2
TRT3 v1 B 16 1
TRT3 v1 C 18 2
TRT3 v2 A 14 1
TRT3 v2 B 11 2
TRT3 v3 C 15 1
;
proc report data=a out=x  nowd NOCOMPLETECOLS;
column trt visno,param,(flg value );
define trt / group;
define visno / across;
define param / across;
define flg / analysis sum;
define value/analysis sum;
compute value;
if _c2_=1  then call define('_c3_',"style","style=[background=yellow]");
else if _c2_=2 then call define('_c3_',"style","style=[background=orange]");
else if _c2_=3 then call define('_c3_',"style","style=[background=red]");

if _c4_=1  then call define('_c5_',"style","style=[background=yellow]");
else if _c4_=2 then call define('_c5_',"style","style=[background=orange]");
else if _c4_=3 then call define('_c5_',"style","style=[background=red]");

if _c6_=1  then call define('_c7_',"style","style=[background=yellow]");
else if _c6_=2 then call define('_c7_',"style","style=[background=orange]");
else if _c6_=3 then call define('_c7_',"style","style=[background=red]");
endcomp;
run;


&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Sep 2017 16:00:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/399245#M96684</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-09-27T16:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc report with color coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/399247#M96686</link>
      <description>&lt;P&gt;Thanks. Got it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 16:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-with-color-coding/m-p/399247#M96686</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2017-09-27T16:07:10Z</dc:date>
    </item>
  </channel>
</rss>

