<?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: Distinct with group by in PROC SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/476222#M71204</link>
    <description>&lt;P&gt;Hi Kiran,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although may not be related to topic but your example is what I was looking for.&amp;nbsp; If you do the same syntax in an sql server the&amp;nbsp;&lt;/P&gt;&lt;P&gt;result would be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123 345 23SEP1974&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;224&amp;nbsp;601&amp;nbsp;22SEP1974&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It is major difference I have seen while trying to filter based on max/min group by. In SAS you would&amp;nbsp;need following code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;abcs&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;distinct&amp;nbsp;&lt;/SPAN&gt;profile_number, sas_id, date&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mindate format=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Date9.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;group&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;profile_number&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;having date = min(date)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I don't know how many types of&amp;nbsp;SQLs are there but I tried on some online websites and they give filtering without using having.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Just wanted to confirm if this is a documented difference with SQL and proc SQL or different SQLs ( MYSQL oracle) also behave differently.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Regards&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Jaskeerat&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Jul 2018 17:19:09 GMT</pubDate>
    <dc:creator>jaskeerat_singh</dc:creator>
    <dc:date>2018-07-07T17:19:09Z</dc:date>
    <item>
      <title>Distinct with group by in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358290#M64317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a proc SQL procedure, and I find a difference in the number of rows between the following queries in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql; 
create table flash.test1 as 
select distinct profile_number, sas_id, min(flash_signup_date) as mindate format=Date9.  
from one.subscriptions where is_flash EQ '1'
and signup_date GT canceled_date
group by profile_number;
quit;



proc sql; 
create table flash.test1 as 
select profile_number, sas_id, min(flash_signup_date) as mindate format=Date9.  
from one.subscriptions where is_flash EQ '1'
and signup_date GT canceled_date
group by profile_number;
quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand if the column sas_id was not present, there would be no use of the &lt;STRONG&gt;&lt;I&gt;distinct &lt;/I&gt;&lt;/STRONG&gt;statement with a group by clause. But can someone clarify how the &lt;STRONG&gt;&lt;EM&gt;distinct&lt;/EM&gt; &lt;/STRONG&gt;in the above SQL statements changes&amp;nbsp;the grouping when used with another additional column?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fun fact: Any combination of distinct and group by throws an error in other&amp;nbsp;DBMS (tested on a couple)&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 17:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358290#M64317</guid>
      <dc:creator>goutamgm92</dc:creator>
      <dc:date>2017-05-12T17:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct with group by in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358297#M64318</link>
      <description>&lt;P&gt;Most databases will not accept a query that uses GROUP BY and includes columns in the result set which are neither one of the grouping variables or a summary statistic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But SAS will happly remerge the summary statistics back onto all detail rows for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if the there are duplicate rows then those are generated also. &amp;nbsp;But if you add the DISTINCT keyword then the duplicate result rows are removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input grp $ extra $ val ;
cards;
A X 2
A X 3
A Y 4
;

proc sql ;
 create table test1 as 
   select grp,extra,sum(val) as tot_val
   from have
   group by 1
   order by 1,2,3
 ;
 create table test2 as 
   select distinct grp,extra,sum(val) as tot_val
   from have
   group by 1
   order by 1,2,3
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2017 17:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358297#M64318</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-12T17:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct with group by in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358302#M64319</link>
      <description>Awesome, thank you! One more observation irrespective of the number of rows in the output, the sum&lt;BR /&gt;(val) contained 9 for both scenarios.</description>
      <pubDate>Fri, 12 May 2017 17:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358302#M64319</guid>
      <dc:creator>goutamgm92</dc:creator>
      <dc:date>2017-05-12T17:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct with group by in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358303#M64320</link>
      <description>&lt;P&gt;Let us try to understand by an example similar to yours&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; profile_number sas_id date:&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;123 345 23SEP1974&lt;/P&gt;
&lt;P&gt;123 228 24SEP1974&lt;/P&gt;
&lt;P&gt;123 607 25SEP1974&lt;/P&gt;
&lt;P&gt;224 601 22SEP1974&lt;/P&gt;
&lt;P&gt;224 601 30SEP1974&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After creating dataset you run the below query&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; abcs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; profile_number, sas_id, min(date) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mindate format=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;Date9.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;group&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; profile_number;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;what this does is create min date with each group and remerges within that group as you see this note&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;/P&gt;
&lt;P&gt;resultant dataset is below (min date for 123 profile_id is 23sep1974 and is repeated within that group)&lt;/P&gt;
&lt;P&gt;profile_number&amp;nbsp;sas_id&amp;nbsp;mindate&lt;BR /&gt;123&amp;nbsp;607&amp;nbsp;23SEP1974&lt;BR /&gt;123&amp;nbsp;345&amp;nbsp;23SEP1974&lt;BR /&gt;123&amp;nbsp;228&amp;nbsp;23SEP1974&lt;BR /&gt;224&amp;nbsp;601&amp;nbsp;22SEP1974&lt;BR /&gt;224&amp;nbsp;601&amp;nbsp;22SEP1974&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;if you see above last 2 row are same and when you apply distinct only one will be left out. In this step distinct is applied after&amp;nbsp; group by and gives result as shown below.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;profile_number&amp;nbsp;sas_id&amp;nbsp;mindate&lt;BR /&gt;123&amp;nbsp;228&amp;nbsp;23SEP1974&lt;BR /&gt;123&amp;nbsp;345&amp;nbsp;23SEP1974&lt;BR /&gt;123&amp;nbsp;607&amp;nbsp;23SEP1974&lt;BR /&gt;224&amp;nbsp;601&amp;nbsp;22SEP1974&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;query for distinct is below&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; abc &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;distinct&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; profile_number, sas_id, min(date) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mindate format=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;Date9.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;group&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; profile_number;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;hope this example makes it clear.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 17:48:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/358303#M64320</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-05-12T17:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct with group by in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/476222#M71204</link>
      <description>&lt;P&gt;Hi Kiran,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although may not be related to topic but your example is what I was looking for.&amp;nbsp; If you do the same syntax in an sql server the&amp;nbsp;&lt;/P&gt;&lt;P&gt;result would be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123 345 23SEP1974&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;224&amp;nbsp;601&amp;nbsp;22SEP1974&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It is major difference I have seen while trying to filter based on max/min group by. In SAS you would&amp;nbsp;need following code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;abcs&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;distinct&amp;nbsp;&lt;/SPAN&gt;profile_number, sas_id, date&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mindate format=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Date9.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;group&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;profile_number&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;having date = min(date)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I don't know how many types of&amp;nbsp;SQLs are there but I tried on some online websites and they give filtering without using having.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Just wanted to confirm if this is a documented difference with SQL and proc SQL or different SQLs ( MYSQL oracle) also behave differently.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Regards&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Jaskeerat&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2018 17:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/476222#M71204</guid>
      <dc:creator>jaskeerat_singh</dc:creator>
      <dc:date>2018-07-07T17:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct with group by in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/476223#M71205</link>
      <description>&lt;P&gt;Please post your question as a new topic.&amp;nbsp; You might want to put in a complete example input and required results out.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2018 17:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Distinct-with-group-by-in-PROC-SQL/m-p/476223#M71205</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-07T17:32:21Z</dc:date>
    </item>
  </channel>
</rss>

