<?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: Using different color format for different row in ODS. in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1881#M835</link>
    <description>David is correct that this is not something that TABULATE does. You might approximate what you want to do with PROC REPORT. In this program, differing formats are applied based on the "row" variable for DIVISION using a CALL DEFINE in a COMPUTE block:[pre]&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
  value CON 0-&amp;lt; 50000 = 'yellow'&lt;BR /&gt;
            50000-high = 'pink';&lt;BR /&gt;
  value EDU  0-&amp;lt; 70000 = 'beige'&lt;BR /&gt;
            70000-high = 'cyan';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods html file='c:\temp\rep_hilite.html'&lt;BR /&gt;
    style=sasweb;&lt;BR /&gt;
&lt;BR /&gt;
proc report data=sashelp.prdsale nowd;&lt;BR /&gt;
column country division prodtype,actual;&lt;BR /&gt;
define country /group noprint;&lt;BR /&gt;
define division/group;&lt;BR /&gt;
define prodtype / across;&lt;BR /&gt;
define actual / sum 'Sales';&lt;BR /&gt;
compute actual;&lt;BR /&gt;
  if division = 'CONSUMER' then do;&lt;BR /&gt;
     call define('_C3_','STYLE','style={background=CON.}');&lt;BR /&gt;
     call define('_C4_','STYLE','style={background=CON.}');&lt;BR /&gt;
  end;&lt;BR /&gt;
  if division = 'EDUCATION' then do;&lt;BR /&gt;
     call define('_C3_','STYLE','style={background=EDU.}');&lt;BR /&gt;
     call define('_C4_','STYLE','style={background=EDU.}');&lt;BR /&gt;
  end;&lt;BR /&gt;
endcomp;&lt;BR /&gt;
by country;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Although there is a bit of brute force programming in that the format is not automatically set, but has to be done inside the CALL DEFINE, this may provide you something close to what you want.&lt;BR /&gt;
  &lt;BR /&gt;
The solution could be adapted to use macro variables, macro do loops or arrays if you have a lot of across variables. I show the "hard-coded" method because I only have 2 across variables.&lt;BR /&gt;
cynthia</description>
    <pubDate>Fri, 01 Dec 2006 23:50:18 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2006-12-01T23:50:18Z</dc:date>
    <item>
      <title>Using different color format for different row in ODS.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1878#M832</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I like to use different format depends on the value of the row variable (TESTCODE) in Proc Tabulate.&lt;BR /&gt;
&lt;BR /&gt;
For example, if TESTCODE = 'ANA', then it should use {STYLE={BACKGROUND=ANA_COL.}}.  if  TESTCODE = 'DNA', then it should use {STYLE={BACKGROUND=DNA_COL.}}.&lt;BR /&gt;
&lt;BR /&gt;
Any idea how I can do this??&lt;BR /&gt;
See the attached code below.&lt;BR /&gt;
&lt;BR /&gt;
Thank you.&lt;BR /&gt;
James&lt;BR /&gt;
&lt;BR /&gt;
-----------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
PROC FORMAT;&lt;BR /&gt;
	value ANA_COL 0-23 = 'GREEN' 23&amp;lt;-HIGH = 'RED' . = 'WHITE' OTHER = 'BLACK';&lt;BR /&gt;
	value DNAR_COL 0-&amp;lt;7 = 'GREEN' 7-HIGH = 'RED' . = 'WHITE' OTHER = 'BLACK';&lt;BR /&gt;
	value DNA_COL 0-20 = 'GREEN' 20&amp;lt;-HIGH = 'RED' . = 'WHITE' OTHER = 'BLACK';&lt;BR /&gt;
	value ENA_COL 0-&amp;lt;8 = 'GREEN' 8-10 = 'BLUE' 10&amp;lt;-HIGH = 'RED' . = 'WHITE' OTHER = 'BLACK';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
PROC TABULATE DATA = IN MISSING;&lt;BR /&gt;
	TITLE;&lt;BR /&gt;
	CLASS SUBJID LBDT TESTCODE VISIT_ID;&lt;BR /&gt;
	VAR LBORRESN;&lt;BR /&gt;
	TABLE SUBJID, TESTCODE, LBDT*LBORRESN*{STYLE={BACKGROUND=ANA_COL.}};&lt;BR /&gt;
RUN;</description>
      <pubDate>Fri, 01 Dec 2006 16:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1878#M832</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-12-01T16:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using different color format for different row in ODS.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1879#M833</link>
      <description>What you're wanting to do is not possible.  You can't vary formats based on data values.&lt;BR /&gt;
&lt;BR /&gt;
-- David Kelley, SAS</description>
      <pubDate>Fri, 01 Dec 2006 18:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1879#M833</guid>
      <dc:creator>David_SAS</dc:creator>
      <dc:date>2006-12-01T18:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using different color format for different row in ODS.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1880#M834</link>
      <description>Thanks.&lt;BR /&gt;
&lt;BR /&gt;
Can you think of any other way to do this??&lt;BR /&gt;
&lt;BR /&gt;
James</description>
      <pubDate>Fri, 01 Dec 2006 18:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1880#M834</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-12-01T18:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using different color format for different row in ODS.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1881#M835</link>
      <description>David is correct that this is not something that TABULATE does. You might approximate what you want to do with PROC REPORT. In this program, differing formats are applied based on the "row" variable for DIVISION using a CALL DEFINE in a COMPUTE block:[pre]&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
  value CON 0-&amp;lt; 50000 = 'yellow'&lt;BR /&gt;
            50000-high = 'pink';&lt;BR /&gt;
  value EDU  0-&amp;lt; 70000 = 'beige'&lt;BR /&gt;
            70000-high = 'cyan';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods html file='c:\temp\rep_hilite.html'&lt;BR /&gt;
    style=sasweb;&lt;BR /&gt;
&lt;BR /&gt;
proc report data=sashelp.prdsale nowd;&lt;BR /&gt;
column country division prodtype,actual;&lt;BR /&gt;
define country /group noprint;&lt;BR /&gt;
define division/group;&lt;BR /&gt;
define prodtype / across;&lt;BR /&gt;
define actual / sum 'Sales';&lt;BR /&gt;
compute actual;&lt;BR /&gt;
  if division = 'CONSUMER' then do;&lt;BR /&gt;
     call define('_C3_','STYLE','style={background=CON.}');&lt;BR /&gt;
     call define('_C4_','STYLE','style={background=CON.}');&lt;BR /&gt;
  end;&lt;BR /&gt;
  if division = 'EDUCATION' then do;&lt;BR /&gt;
     call define('_C3_','STYLE','style={background=EDU.}');&lt;BR /&gt;
     call define('_C4_','STYLE','style={background=EDU.}');&lt;BR /&gt;
  end;&lt;BR /&gt;
endcomp;&lt;BR /&gt;
by country;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Although there is a bit of brute force programming in that the format is not automatically set, but has to be done inside the CALL DEFINE, this may provide you something close to what you want.&lt;BR /&gt;
  &lt;BR /&gt;
The solution could be adapted to use macro variables, macro do loops or arrays if you have a lot of across variables. I show the "hard-coded" method because I only have 2 across variables.&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 01 Dec 2006 23:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-different-color-format-for-different-row-in-ODS/m-p/1881#M835</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2006-12-01T23:50:18Z</dc:date>
    </item>
  </channel>
</rss>

