<?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 PROC SQL &amp;amp; MAX in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-amp-MAX/m-p/563502#M74973</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came across with a statement like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql;
    create table tmp01 as 
    select    col1
            , col2
            , max(col3, col4) as MaxVar
    from ...
    ;
quit;&lt;/PRE&gt;&lt;P&gt;So, MAX is used without GROUP BY seemingly as a (row wise) scalar function like within a DATA STEP. Being familiar with "native SQL", I would have expected something like CASE WHEN ELSE END or GREATEST instead of MAX, but the results seem to be the same. Hence, my question is: Can I really use MAX within PROC SQL as it is done within the example? (Correct results also might by coincidence.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help, Sven&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2019 12:46:54 GMT</pubDate>
    <dc:creator>SvenWagner</dc:creator>
    <dc:date>2019-06-04T12:46:54Z</dc:date>
    <item>
      <title>PROC SQL &amp; MAX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-amp-MAX/m-p/563502#M74973</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came across with a statement like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql;
    create table tmp01 as 
    select    col1
            , col2
            , max(col3, col4) as MaxVar
    from ...
    ;
quit;&lt;/PRE&gt;&lt;P&gt;So, MAX is used without GROUP BY seemingly as a (row wise) scalar function like within a DATA STEP. Being familiar with "native SQL", I would have expected something like CASE WHEN ELSE END or GREATEST instead of MAX, but the results seem to be the same. Hence, my question is: Can I really use MAX within PROC SQL as it is done within the example? (Correct results also might by coincidence.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help, Sven&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:46:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-amp-MAX/m-p/563502#M74973</guid>
      <dc:creator>SvenWagner</dc:creator>
      <dc:date>2019-06-04T12:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL &amp; MAX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-amp-MAX/m-p/563508#M74975</link>
      <description>&lt;P&gt;When you use max() (and other such functions, like min() or avg()) with more than one argument, then it works "horizontally" within the current observation.&lt;/P&gt;
&lt;P&gt;With only one column name as parameter, it turns into a summary function that works "vertically" for the group (or the whole dataset).&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-amp-MAX/m-p/563508#M74975</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-04T12:56:10Z</dc:date>
    </item>
  </channel>
</rss>

