<?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: GET Maximum values on a row should be highlighted in sas Proc Report in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/GET-Maximum-values-on-a-row-should-be-highlighted-in-sas-Proc/m-p/568680#M11701</link>
    <description>&lt;P&gt;Thanks for answer.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jun 2019 10:07:00 GMT</pubDate>
    <dc:creator>sivastat08</dc:creator>
    <dc:date>2019-06-25T10:07:00Z</dc:date>
    <item>
      <title>GET Maximum values on a row should be highlighted in sas Proc Report</title>
      <link>https://communities.sas.com/t5/New-SAS-User/GET-Maximum-values-on-a-row-should-be-highlighted-in-sas-Proc/m-p/567881#M11583</link>
      <description>&lt;P&gt;Hi Get Maximum values on a row should be highlighted in&amp;nbsp;SAS PROC Report,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below is the code i have tried but its not working for me. Kindly help on getting maximum of (MAX_of_Invoice)&lt;/P&gt;&lt;P&gt;&amp;nbsp;row should be highlighted in PROC report&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SQL INOBS=50;&lt;BR /&gt;CREATE TABLE WORK.QUERY_FOR_CARS1 AS&lt;BR /&gt;SELECT&lt;BR /&gt;t1.Make,&lt;BR /&gt;t1.Invoice&lt;BR /&gt;FROM SASHELP.CARS t1;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;proc sort data=QUERY_FOR_CARS1 out=QUERY_FOR_CARS2;&lt;BR /&gt;by Make Invoice;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data QUERY_FOR_CARS3;&lt;BR /&gt;set QUERY_FOR_CARS2;&lt;BR /&gt;by Make Invoice;&lt;BR /&gt;Seq+1;&lt;BR /&gt;if first.Make then Seq=1;&lt;BR /&gt;run;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.QUERY_FOR_CARS3_0000 AS&lt;BR /&gt;SELECT t1.Make,&lt;BR /&gt;/* MAX_of_Invoice */&lt;BR /&gt;(MAX(t1.Invoice)) FORMAT=DOLLAR8. AS MAX_of_Invoice&lt;BR /&gt;FROM WORK.QUERY_FOR_CARS3 t1&lt;BR /&gt;GROUP BY t1.Make;&lt;BR /&gt;QUIT;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.QUERY_FOR_CARS3_0001 AS&lt;BR /&gt;SELECT t1.Make,&lt;BR /&gt;t1.Invoice,&lt;BR /&gt;t1.Seq,&lt;BR /&gt;t2.MAX_of_Invoice&lt;BR /&gt;FROM WORK.QUERY_FOR_CARS3 t1&lt;BR /&gt;LEFT JOIN WORK.QUERY_FOR_CARS3_0000 t2 ON (t1.Make = t2.Make);&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;proc report data=work.QUERY_FOR_CARS3_0001;&lt;BR /&gt;title HEIGHT=.25in 'Testing Max Vol' bold;&lt;BR /&gt;column Make Invoice Seq MAX_of_Invoice;&lt;BR /&gt;define Make/center;&lt;BR /&gt;define Invoice/center;&lt;BR /&gt;/* define Seq/center;*/&lt;BR /&gt;define MAX_of_Invoice/center display ;&lt;BR /&gt;compute Invoice;&lt;/P&gt;&lt;P&gt;if _C2_ = _C4_ then&lt;BR /&gt;call define(_row_,"style","style={background=red}");&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&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>Fri, 21 Jun 2019 11:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/GET-Maximum-values-on-a-row-should-be-highlighted-in-sas-Proc/m-p/567881#M11583</guid>
      <dc:creator>sivastat08</dc:creator>
      <dc:date>2019-06-21T11:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: GET Maximum values on a row should be highlighted in sas Proc Report</title>
      <link>https://communities.sas.com/t5/New-SAS-User/GET-Maximum-values-on-a-row-should-be-highlighted-in-sas-Proc/m-p/568147#M11622</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I'm not sure why you are using ABSOLUTE COLUMN NUMBERs here... they are not appropriate since you don't have any ACROSS items. Your real problem is that your COLUMN statement shows INVOICE as appearing BEFORE MAX_OF_INVOICE in the COLUMN statement. That means:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc_report_left_to_right.png" style="width: 316px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30466iBF71CD0784C74824/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc_report_left_to_right.png" alt="proc_report_left_to_right.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In a COMPUTE block for INVOICE, PROC REPORT only knows the value of MAKE. It does NOT yet know the value of SEQ or MAX_OF_INVOICE -- because PROC REPORT works from left-to-right in placing items on the report row. So a variable in a COLUMN statement can only test a value that appears BEFORE it on the COLUMN statement -- as shown above. SEQ and MAX_OF_INVOICE are not known to PROC REPORT in the COMPUTE block for INVOICE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I also don't know why you have or need so many PROC SQL steps. I'm also not sure of the purpose of the SEQ variable. You probably don't want MAKE to be a usage of GROUP, I would guess you mean for it to be a usage of ORDER and maybe you are forcing SEQ to show every row because with a usage of GROUP for MAKE, all the numeric rows would collapse down to 1 row for each make and be summarized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; However, you're sorting the SASHELP.CARS by MAKE and INVOICE -- which means that last value for MAKE will always be the MAX value. There are really 2 possible solutions without all the SQL steps (but keeping the DATA step so you get SEQ -- and one of my solutions uses a macro variable for each MAKE value to hold the max amount for that MAKE.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's how I made the data:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cars_data.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30467i6105092BC9B7FD00/image-size/large?v=v2&amp;amp;px=999" role="button" title="cars_data.png" alt="cars_data.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then here's report 1 using the CARS2 data:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alt1.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30468i820411CE527497C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt1.png" alt="alt1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here is alternate approach 2 using the CARS2 data and the macro variables from the DATA step program:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alt2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30469iE0C267FFADAD33C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt2.png" alt="alt2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to hide the column for MAKE that shows the ORDER usage, then just remove the comment delimiters from around the NOPRINT option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this gives you some other ideas for a solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jun 2019 18:44:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/GET-Maximum-values-on-a-row-should-be-highlighted-in-sas-Proc/m-p/568147#M11622</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-06-22T18:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: GET Maximum values on a row should be highlighted in sas Proc Report</title>
      <link>https://communities.sas.com/t5/New-SAS-User/GET-Maximum-values-on-a-row-should-be-highlighted-in-sas-Proc/m-p/568680#M11701</link>
      <description>&lt;P&gt;Thanks for answer.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 10:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/GET-Maximum-values-on-a-row-should-be-highlighted-in-sas-Proc/m-p/568680#M11701</guid>
      <dc:creator>sivastat08</dc:creator>
      <dc:date>2019-06-25T10:07:00Z</dc:date>
    </item>
  </channel>
</rss>

