<?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: How can I perform Conditional Highlighting based on Calculated Values? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32299#M4245</link>
    <description>Hi:&lt;BR /&gt;
  If you let PROC REPORT calculate the report averages, then you can use the PROC REPORT code below to have conditional highlighting show in the report. There are other ways to do this, the method I show is the PROC REPORT method.&lt;BR /&gt;
 &lt;BR /&gt;
  Note, that this is NOT the method you would use if you were going to do conditional highlighting in Web Report Studio with an Information Map.&lt;BR /&gt;
    &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data branchdata;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input Branch $ Jan Feb March;&lt;BR /&gt;
datalines;&lt;BR /&gt;
BRANCH1  1000   12000 3000&lt;BR /&gt;
BRANCH2   2000  1300   4000&lt;BR /&gt;
BRANCH3   6000  1700  17000 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
ods html file='c:\temp\hilite.html' style=egdefault;&lt;BR /&gt;
proc report data=branchdata nowd;&lt;BR /&gt;
  title 'Proc Report Highlight';&lt;BR /&gt;
  title2 'Data has 1 obs per branch';&lt;BR /&gt;
  column branch jan feb march;&lt;BR /&gt;
  define branch /order;&lt;BR /&gt;
  define jan / mean;&lt;BR /&gt;
  define feb / mean;&lt;BR /&gt;
  define march/mean;&lt;BR /&gt;
  rbreak after / summarize;&lt;BR /&gt;
  compute before;&lt;BR /&gt;
     holdjan = jan.mean;&lt;BR /&gt;
     holdfeb = feb.mean;&lt;BR /&gt;
     holdmar = march.mean;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute jan;&lt;BR /&gt;
    if jan.mean gt holdjan then &lt;BR /&gt;
       call define(_COL_,'style','style={foreground=red font_weight=bold}');&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute feb;&lt;BR /&gt;
    if feb.mean gt holdfeb then &lt;BR /&gt;
       call define(_COL_,'style','style={foreground=red font_weight=bold}');&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute march;&lt;BR /&gt;
    if march.mean gt holdmar then &lt;BR /&gt;
       call define(_COL_,'style','style={foreground=red font_weight=bold}');&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after ;&lt;BR /&gt;
    branch = 'Average';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Fri, 18 Jul 2008 16:44:20 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2008-07-18T16:44:20Z</dc:date>
    <item>
      <title>How can I perform Conditional Highlighting based on Calculated Values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32298#M4244</link>
      <description>I want to perform conditional highlighting based on the average sales per month. Given a data that contains monthly sales by branch, I want to highlight those figures that exceeds the month's average sales. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
.................... JAN...................FEB................MARCH&lt;BR /&gt;
BRANCH1.....1000..................12000................3000&lt;BR /&gt;
BRANCH2......2000.................1300..................4000&lt;BR /&gt;
BRANCH3......6000.................1700.................17000 &lt;BR /&gt;
AVERAGE.....3000.................5000...................8000&lt;BR /&gt;
&lt;BR /&gt;
Using this example, I want to highlight the values that exceeds the average (6000 for Jan, 12000 for feb and 17000)</description>
      <pubDate>Fri, 18 Jul 2008 08:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32298#M4244</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-07-18T08:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I perform Conditional Highlighting based on Calculated Values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32299#M4245</link>
      <description>Hi:&lt;BR /&gt;
  If you let PROC REPORT calculate the report averages, then you can use the PROC REPORT code below to have conditional highlighting show in the report. There are other ways to do this, the method I show is the PROC REPORT method.&lt;BR /&gt;
 &lt;BR /&gt;
  Note, that this is NOT the method you would use if you were going to do conditional highlighting in Web Report Studio with an Information Map.&lt;BR /&gt;
    &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data branchdata;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input Branch $ Jan Feb March;&lt;BR /&gt;
datalines;&lt;BR /&gt;
BRANCH1  1000   12000 3000&lt;BR /&gt;
BRANCH2   2000  1300   4000&lt;BR /&gt;
BRANCH3   6000  1700  17000 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
ods html file='c:\temp\hilite.html' style=egdefault;&lt;BR /&gt;
proc report data=branchdata nowd;&lt;BR /&gt;
  title 'Proc Report Highlight';&lt;BR /&gt;
  title2 'Data has 1 obs per branch';&lt;BR /&gt;
  column branch jan feb march;&lt;BR /&gt;
  define branch /order;&lt;BR /&gt;
  define jan / mean;&lt;BR /&gt;
  define feb / mean;&lt;BR /&gt;
  define march/mean;&lt;BR /&gt;
  rbreak after / summarize;&lt;BR /&gt;
  compute before;&lt;BR /&gt;
     holdjan = jan.mean;&lt;BR /&gt;
     holdfeb = feb.mean;&lt;BR /&gt;
     holdmar = march.mean;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute jan;&lt;BR /&gt;
    if jan.mean gt holdjan then &lt;BR /&gt;
       call define(_COL_,'style','style={foreground=red font_weight=bold}');&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute feb;&lt;BR /&gt;
    if feb.mean gt holdfeb then &lt;BR /&gt;
       call define(_COL_,'style','style={foreground=red font_weight=bold}');&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute march;&lt;BR /&gt;
    if march.mean gt holdmar then &lt;BR /&gt;
       call define(_COL_,'style','style={foreground=red font_weight=bold}');&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after ;&lt;BR /&gt;
    branch = 'Average';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 18 Jul 2008 16:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32299#M4245</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-07-18T16:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I perform Conditional Highlighting based on Calculated Values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32300#M4246</link>
      <description>Thank you, however, is there a way that we could produce the same output using PROC TABULATE?

Message was edited by: Axe</description>
      <pubDate>Sun, 20 Jul 2008 04:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32300#M4246</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-07-20T04:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I perform Conditional Highlighting based on Calculated Values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32301#M4247</link>
      <description>Hi:&lt;BR /&gt;
  Yes, there is a method with PROC TABULATE, but it involves making one pass through the data (one way or another) to find out what the overall averages are. That's because the way you do conditional highlighting with PROC TABULATE is with a user-defined format and in order to code the format, you need to know the averages -before- you can use them in PROC TABULATE.&lt;BR /&gt;
 &lt;BR /&gt;
  You have 2 choices for how to build the user-defined format -- either you hardcode the averages or you create macro variables with the averages. The program below shows the second method -- with macro variables to hold the averages for each month.&lt;BR /&gt;
&lt;BR /&gt;
  After you have created the user-defined format, then you USE the format in a STYLE= override within PROC TABULATE code. This example uses the same BRANCHDATA as the previous example, with one obs per branch.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data branchdata;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input Branch $ Jan Feb March;&lt;BR /&gt;
datalines;&lt;BR /&gt;
BRANCH1  1000   12000 3000&lt;BR /&gt;
BRANCH2   2000  1300   4000&lt;BR /&gt;
BRANCH3   6000  1700  17000 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                   &lt;BR /&gt;
** Make one pass through the data to get;&lt;BR /&gt;
** averages for each month and create ;&lt;BR /&gt;
** a macro variable for each average.;&lt;BR /&gt;
                    &lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
  select mean(jan),&lt;BR /&gt;
         mean(feb),&lt;BR /&gt;
         mean(march)&lt;BR /&gt;
  into :m1, :m2, :m3&lt;BR /&gt;
  from work.branchdata;&lt;BR /&gt;
quit;&lt;BR /&gt;
                      &lt;BR /&gt;
** Prove that macro variables hold the;&lt;BR /&gt;
** numbers of interest.;&lt;BR /&gt;
%put ---- jan mean is: &amp;amp;m1;&lt;BR /&gt;
%put ---- feb mean is &amp;amp;m2;&lt;BR /&gt;
%put ---- mar mean is &amp;amp;m3;&lt;BR /&gt;
                                        &lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
** In order to code this format, you have;&lt;BR /&gt;
** to find out what the average is for;&lt;BR /&gt;
** each month. Either you hardcode the value;&lt;BR /&gt;
** or in an advanced solution, you use macro;&lt;BR /&gt;
** variables as shown here. In this instance,;&lt;BR /&gt;
** the macro variables are being used as;&lt;BR /&gt;
** numeric constants, so they are not quoted.;&lt;BR /&gt;
** The label for the format is the foreground color;&lt;BR /&gt;
** which should be assigned.;&lt;BR /&gt;
                           &lt;BR /&gt;
  value janmean &amp;amp;m1-high = 'red'&lt;BR /&gt;
                other = 'black';&lt;BR /&gt;
                 &lt;BR /&gt;
  value febmean &amp;amp;m2-high = 'red'&lt;BR /&gt;
                 other = 'black';&lt;BR /&gt;
               &lt;BR /&gt;
  value marmean &amp;amp;m3-high = 'red'&lt;BR /&gt;
                 other = 'black';&lt;BR /&gt;
                      &lt;BR /&gt;
  value allmean other = 'black';&lt;BR /&gt;
run;&lt;BR /&gt;
                                 &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods html file='c:\temp\hilite_tab.html' style=egdefault;&lt;BR /&gt;
proc tabulate data=branchdata f=comma6.;&lt;BR /&gt;
  title 'Proc Tabulate Highlight';&lt;BR /&gt;
  class branch;&lt;BR /&gt;
  var jan feb march;&lt;BR /&gt;
  table &lt;BR /&gt;
    branch*sum=' ' all*mean=' '*{s={foreground=allmean. font_weight=bold}},&lt;BR /&gt;
         (jan*{s={foreground=janmean.}} &lt;BR /&gt;
          feb*{s={foreground=febmean.}} &lt;BR /&gt;
          march*{s={foreground=marmean.}})&lt;BR /&gt;
     /style_precedence=row row=float;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sun, 20 Jul 2008 17:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32301#M4247</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-07-20T17:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I perform Conditional Highlighting based on Calculated Values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32302#M4248</link>
      <description>Thanks for your help!</description>
      <pubDate>Mon, 21 Jul 2008 09:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-can-I-perform-Conditional-Highlighting-based-on-Calculated/m-p/32302#M4248</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-07-21T09:00:18Z</dc:date>
    </item>
  </channel>
</rss>

