<?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: Highlight the field based on another field meaning in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563543#M22823</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/276630"&gt;@OLevin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I was wondering, why my example didn't work, because I showed both fields in col definition. But the trick is to show created field (in my case it is Letter) before Hight. And it works now!&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Great! Thank you so much!!!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A general rule with proc report is that the result table is built from left to right. So a calculated field can't reference the value of a column further to the right to set current cell properties or values because that cell has not been built yet.&lt;/P&gt;
&lt;P&gt;So in:&lt;/P&gt;
&lt;PRE&gt;proc report nowd data=test;
col name sex age weight height letter; 

compute height;
if letter="A" then do;
call define(_col_,"style","style={background = pink}");
end;
endcomp;
run;&lt;/PRE&gt;
&lt;P&gt;since the column order has LETTER to the right of HEIGHT the value of letter is considered undefined for setting column height properties.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2019 15:12:01 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-06-04T15:12:01Z</dc:date>
    <item>
      <title>Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563492#M22817</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I am trying to create the report and higlight one field based on another field meaning. It is similar to what I found in SAS communiy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;proc report nowd data=sashelp.class;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;col name sex age weight height; &lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;compute height;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;if sex='F' then do;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;call define(_col_,"style","style={background = pink}");&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;end;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;endcomp;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the thing is if you use, let's say, Weight instead of Sex field in a compute block - it doesn't work!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;proc report nowd data=sashelp.class;;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;col name sex age weight height; &lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;compute height;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;if weight&amp;gt;100 then do;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;call define(_col_,"style","style={background = pink}");&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;end;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;endcomp;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my data, I am creating an additional field in dataset and after that I am trying to use it as an indicator to highlight the other filed. Like,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;data test;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;set sashelp.class;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;letter = substr(name,1,1);&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;run;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;proc report nowd data=test;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;col name sex age weight height letter; &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;compute height;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;if letter="A" then do;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;call define(_col_,"style","style={background = pink}");&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;end;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;endcomp;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;run;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code again doesn't give me desired result. Can somebody give me a hint WHY?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563492#M22817</guid>
      <dc:creator>OLevin</dc:creator>
      <dc:date>2019-06-04T12:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563494#M22818</link>
      <description>&lt;P&gt;When you refer to a numeric field, you have to add ".sum" to make it work. For example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report nowd data=sashelp.class;;
  col name sex age weight height; 

  compute height;
    if weight.sum&amp;gt;100 then do;
      call define(_col_,"style","style={background = pink}");
    end;
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563494#M22818</guid>
      <dc:creator>ThierryHerrie</dc:creator>
      <dc:date>2019-06-04T12:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563496#M22819</link>
      <description>&lt;P&gt;Thank you very much, Thierry&lt;SPAN class=""&gt;- with numeric value it now works! Do you have any solution for the second example, when I added field to the sas dataset and after that trying to use it in compute block? It is string format (letter). What can I do here in order to make it work?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563496#M22819</guid>
      <dc:creator>OLevin</dc:creator>
      <dc:date>2019-06-04T12:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563497#M22820</link>
      <description>&lt;P&gt;You're welcome.&lt;/P&gt;&lt;P&gt;The second example works if you show Height and Letter in the col definition&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report nowd data=test;
  col name sex age weight letter height ; 

  compute height;
    if letter="A" then do;
      call define(_col_,"style","style={background = pink}");
    end;
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563497#M22820</guid>
      <dc:creator>ThierryHerrie</dc:creator>
      <dc:date>2019-06-04T12:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563498#M22821</link>
      <description>&lt;P&gt;I was wondering, why my example didn't work, because I showed both fields in col definition. But the trick is to show created field (in my case it is Letter) before Hight. And it works now!&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Great! Thank you so much!!!!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563498#M22821</guid>
      <dc:creator>OLevin</dc:creator>
      <dc:date>2019-06-04T12:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563501#M22822</link>
      <description>Sorry, I made a typo. Instead of "show" I meant "swap" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563501#M22822</guid>
      <dc:creator>ThierryHerrie</dc:creator>
      <dc:date>2019-06-04T12:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563543#M22823</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/276630"&gt;@OLevin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I was wondering, why my example didn't work, because I showed both fields in col definition. But the trick is to show created field (in my case it is Letter) before Hight. And it works now!&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Great! Thank you so much!!!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A general rule with proc report is that the result table is built from left to right. So a calculated field can't reference the value of a column further to the right to set current cell properties or values because that cell has not been built yet.&lt;/P&gt;
&lt;P&gt;So in:&lt;/P&gt;
&lt;PRE&gt;proc report nowd data=test;
col name sex age weight height letter; 

compute height;
if letter="A" then do;
call define(_col_,"style","style={background = pink}");
end;
endcomp;
run;&lt;/PRE&gt;
&lt;P&gt;since the column order has LETTER to the right of HEIGHT the value of letter is considered undefined for setting column height properties.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 15:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563543#M22823</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-04T15:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight the field based on another field meaning</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563553#M22824</link>
      <description>It is a very helpful information! Thank you very much, ballardw.</description>
      <pubDate>Tue, 04 Jun 2019 15:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Highlight-the-field-based-on-another-field-meaning/m-p/563553#M22824</guid>
      <dc:creator>OLevin</dc:creator>
      <dc:date>2019-06-04T15:35:25Z</dc:date>
    </item>
  </channel>
</rss>

