<?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: The REPORT procedure: Formatting a row based on the value of one cell in that row. in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/The-REPORT-procedure-Formatting-a-row-based-on-the-value-of-one/m-p/748010#M25075</link>
    <description />
    <pubDate>Tue, 15 Jun 2021 01:48:28 GMT</pubDate>
    <dc:creator>mftuchman</dc:creator>
    <dc:date>2021-06-15T01:48:28Z</dc:date>
    <item>
      <title>The REPORT procedure: Formatting a row based on the value of one cell in that row.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/The-REPORT-procedure-Formatting-a-row-based-on-the-value-of-one/m-p/747976#M25070</link>
      <description>&lt;P&gt;Consider the example here:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p14xegao6xt0xnn1865r422tpytw.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p14xegao6xt0xnn1865r422tpytw.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Under the heading, "Using a Format to Assign a Style Attribute Value", you'll see an example where cells are highlighted red if its value is negative.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I highlight the &lt;EM&gt;entire row&lt;/EM&gt; as red if the value in the difference column were negative?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Taking this one step further: Can&amp;nbsp; I make &lt;EM&gt;the selected&amp;nbsp; row&lt;/EM&gt; bold, red, and 18 pt, without having to use three separate formats (one for size, one for color, and one for font_weight?)&lt;BR /&gt;&lt;BR /&gt;I can do this with PROC TEMPLATE using CELLSTYLE AS, but I can't find the solution for proc report.&amp;nbsp; Possibly can I use PROC TEMPLATE on the template that PROC REPORT uses?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&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;</description>
      <pubDate>Mon, 14 Jun 2021 22:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/The-REPORT-procedure-Formatting-a-row-based-on-the-value-of-one/m-p/747976#M25070</guid>
      <dc:creator>mftuchman</dc:creator>
      <dc:date>2021-06-14T22:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: The REPORT procedure: Formatting a row based on the value of one cell in that row.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/The-REPORT-procedure-Formatting-a-row-based-on-the-value-of-one/m-p/747984#M25071</link>
      <description>&lt;P&gt;You can't use format to apply a style attribute to the entire row because a format is evaluated in each cell, so in order to apply a style attribute to an entire row, each cell in that row would need to have the same value.&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 test;
	input AFL $ BFL $ CFL $;
	cards;
Y Y Y
Y N Y
N N N
;

proc format;
	value $color
		'Y' = 'green'
		'N' = 'red';
run;

proc report data=test
	style(column)={backgroundcolor=$color.};
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture.PNG" style="width: 175px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60385i4FA230D13D0D5AE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;To apply a style attribute to an entire using the value of a specific variable, you need to use CALL DEFINE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*if using the already created format: $color */
proc report data=test;
	compute CFL;
		call define(_row_,'style',cats('style={backgroundcolor=',put(CFL,$color.),'}'));
	endcomp;
run;

/*using conditional statements */
proc report data=test;
	compute CFL;
		if CFL = 'Y' then
			call define(_row_,'style','style={backgroundcolor=green}');
		else if CFL = 'Y' then
			call define(_row_,'style','style={backgroundcolor=red}');
	endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture.PNG" style="width: 166px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60386iF70B22F2E7980F84/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The key is the _ROW_ automatic variable that indicates the entire current row.&lt;/P&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;</description>
      <pubDate>Mon, 14 Jun 2021 22:58:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/The-REPORT-procedure-Formatting-a-row-based-on-the-value-of-one/m-p/747984#M25071</guid>
      <dc:creator>Athenkosi</dc:creator>
      <dc:date>2021-06-14T22:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: The REPORT procedure: Formatting a row based on the value of one cell in that row.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/The-REPORT-procedure-Formatting-a-row-based-on-the-value-of-one/m-p/748010#M25075</link>
      <description />
      <pubDate>Tue, 15 Jun 2021 01:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/The-REPORT-procedure-Formatting-a-row-based-on-the-value-of-one/m-p/748010#M25075</guid>
      <dc:creator>mftuchman</dc:creator>
      <dc:date>2021-06-15T01:48:28Z</dc:date>
    </item>
  </channel>
</rss>

