<?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: find a group of data which has same variable 1 and different variable 2 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/find-a-group-of-data-which-has-same-variable-1-and-different/m-p/493390#M129783</link>
    <description>&lt;P&gt;Why are you selecting everything (*) from all input tables?&amp;nbsp; This is why you get the warnings.&amp;nbsp; You should know what variable you want in the output dataset, select them.&lt;/P&gt;
&lt;P&gt;Next you are "grouping" the data by one variable, and "sorting" the data by another.&amp;nbsp; This is a conflict and why you get the error.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Sep 2018 12:57:42 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-09-07T12:57:42Z</dc:date>
    <item>
      <title>find a group of data which has same variable 1 and different variable 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-a-group-of-data-which-has-same-variable-1-and-different/m-p/493382#M129780</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to find a group of data which has same&amp;nbsp;docdb_family_id and different psn_name, by following codes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  CREATE table Step1.example2 AS
   SELECT *
   FROM Pat_ori.Applicationsnew AS ap 
    LEFT JOIN Pat_ori.Personapplication as pe on ap.appln_id = pe.appln_id
    LEFT JOIN Pat_ori.Companies as co on pe.person_id = co.person_id
   WHERE docdb_family_id = docdb_family_id
   AND psn_name eq psn_name
   GROUP BY docdb_family_id
   ORDER BY ap.appln_id
;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but the result shows that&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;13   PROC SQL;
14     CREATE table Step1.example2 AS
15      SELECT *
16      FROM Pat_ori.Applicationsnew AS ap
17       LEFT JOIN Pat_ori.Personapplication as pe on ap.appln_id = pe.appln_id
18       LEFT JOIN Pat_ori.Companies as co on pe.person_id = co.person_id
19      WHERE docdb_family_id = docdb_family_id
20      AND psn_name eq psn_name
21      GROUP BY docdb_family_id
22      ORDER BY ap.appln_id
23   ;
NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING
      clause of the associated table-expression referenced a summary function.
WARNING: Variable appln_id already exists on file STEP1.EXAMPLE2.
WARNING: Variable person_id already exists on file STEP1.EXAMPLE2.
&lt;U&gt;ERROR: Sort execution failure.&lt;/U&gt;

24   QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           2:03:55.52
      cpu time            20:32.36&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Could you please give me suggestion&amp;nbsp;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 12:46:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-a-group-of-data-which-has-same-variable-1-and-different/m-p/493382#M129780</guid>
      <dc:creator>France</dc:creator>
      <dc:date>2018-09-07T12:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: find a group of data which has same variable 1 and different variable 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-a-group-of-data-which-has-same-variable-1-and-different/m-p/493389#M129782</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I think you can get rid of the WHERE clause as filtering by variables equal to themselves won't change the resulting output.&lt;BR /&gt;&lt;BR /&gt;Since you don't provide data, i can't test here but try :&lt;BR /&gt;&lt;BR /&gt;GROUP BY docdb_family_id&lt;BR /&gt;HAVING count(*) ne count(DISTINCT psn_name)</description>
      <pubDate>Fri, 07 Sep 2018 12:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-a-group-of-data-which-has-same-variable-1-and-different/m-p/493389#M129782</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-09-07T12:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: find a group of data which has same variable 1 and different variable 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-a-group-of-data-which-has-same-variable-1-and-different/m-p/493390#M129783</link>
      <description>&lt;P&gt;Why are you selecting everything (*) from all input tables?&amp;nbsp; This is why you get the warnings.&amp;nbsp; You should know what variable you want in the output dataset, select them.&lt;/P&gt;
&lt;P&gt;Next you are "grouping" the data by one variable, and "sorting" the data by another.&amp;nbsp; This is a conflict and why you get the error.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 12:57:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-a-group-of-data-which-has-same-variable-1-and-different/m-p/493390#M129783</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-07T12:57:42Z</dc:date>
    </item>
  </channel>
</rss>

