<?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: Keep non unique IDs with non-repeated codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-non-unique-IDs-with-non-repeated-codes/m-p/861921#M340434</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Obs ID $12. code $;
cards;
1 AC0000037163 C1
2 AC0000037163 U1
3 BE0000037282 U1
4 BE0000037282 U2
5 CZE0000037693 C2
6 CZE0000037693 C2
7 FR0000037738 U2
8 FR0000037738 C2
;

proc sql;
   create table want as
   select *
   from have
   group by ID
   having count(distinct code) &amp;gt; 1
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 02 Mar 2023 11:53:59 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2023-03-02T11:53:59Z</dc:date>
    <item>
      <title>Keep non unique IDs with non-repeated codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-non-unique-IDs-with-non-repeated-codes/m-p/861919#M340433</link>
      <description>&lt;P&gt;I have a dataset like this (below).&amp;nbsp;The variable code takes 4 possible values&lt;/P&gt;&lt;P&gt;The ID variable is not unique. There can be an ID with 2, 3 or 4 codes, although it's rare with 3 and 4. I want to keep the non-unique IDs that have different codes (or conversely, remove the non-unique IDs with repeated codes).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input Obs ID $12. code $;
cards;
1 AC0000037163 C1
2 AC0000037163 U1
3 BE0000037282 U1
4 BE0000037282 U2&lt;BR /&gt;5 CZE0000037693 C2&lt;BR /&gt;6 CZE0000037693 C2
7 FR0000037738 U2
8 FR0000037738 C2
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data want;
input Obs ID $12. code $;
cards;
1 AC0000037163 C1
2 AC0000037163 U1
3 BE0000037282 U1
4 BE0000037282 U2&lt;BR /&gt;7 FR0000037738 U2
8 FR0000037738 C2
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 11:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-non-unique-IDs-with-non-repeated-codes/m-p/861919#M340433</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-03-02T11:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Keep non unique IDs with non-repeated codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-non-unique-IDs-with-non-repeated-codes/m-p/861921#M340434</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Obs ID $12. code $;
cards;
1 AC0000037163 C1
2 AC0000037163 U1
3 BE0000037282 U1
4 BE0000037282 U2
5 CZE0000037693 C2
6 CZE0000037693 C2
7 FR0000037738 U2
8 FR0000037738 C2
;

proc sql;
   create table want as
   select *
   from have
   group by ID
   having count(distinct code) &amp;gt; 1
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2023 11:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-non-unique-IDs-with-non-repeated-codes/m-p/861921#M340434</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-03-02T11:53:59Z</dc:date>
    </item>
  </channel>
</rss>

