<?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 Compare values within records of same group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compare-values-within-records-of-same-group/m-p/354638#M82983</link>
    <description>&lt;P&gt;I need to compare transactional data with the ID group. I want to keep in the dataset if the values of type are the same within the records with the same id. Any records that do not match the type at least twice within the id grouping should be dropped.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have this data:&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input id $4. type $2. Code $1.;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;abc hb y&lt;/P&gt;
&lt;P&gt;abc hb e&lt;/P&gt;
&lt;P&gt;abc mb w&lt;/P&gt;
&lt;P&gt;abc mb u&lt;/P&gt;
&lt;P&gt;abc cc y&lt;/P&gt;
&lt;P&gt;cba mb b&lt;/P&gt;
&lt;P&gt;cba hb y&lt;/P&gt;
&lt;P&gt;bac hb n&lt;/P&gt;
&lt;P&gt;bac hb a&lt;/P&gt;
&lt;P&gt;def cc y&lt;/P&gt;
&lt;P&gt;def cc x&lt;/P&gt;
&lt;P&gt;def cc w&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;desired output dataset should contain:&lt;/P&gt;
&lt;P&gt;abc hb y&lt;/P&gt;
&lt;P&gt;abc hb e&lt;/P&gt;
&lt;P&gt;abc mb w&lt;/P&gt;
&lt;P&gt;abc mb u&lt;/P&gt;
&lt;P&gt;bac hb n&lt;/P&gt;
&lt;P&gt;bac hb a&lt;/P&gt;
&lt;P&gt;def cc y&lt;/P&gt;
&lt;P&gt;def cc x&lt;/P&gt;
&lt;P&gt;def cc w&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just don’t know how to do an iterative compare with multiple records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Sat, 29 Apr 2017 00:14:04 GMT</pubDate>
    <dc:creator>Elliott</dc:creator>
    <dc:date>2017-04-29T00:14:04Z</dc:date>
    <item>
      <title>Compare values within records of same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-values-within-records-of-same-group/m-p/354638#M82983</link>
      <description>&lt;P&gt;I need to compare transactional data with the ID group. I want to keep in the dataset if the values of type are the same within the records with the same id. Any records that do not match the type at least twice within the id grouping should be dropped.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have this data:&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input id $4. type $2. Code $1.;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;abc hb y&lt;/P&gt;
&lt;P&gt;abc hb e&lt;/P&gt;
&lt;P&gt;abc mb w&lt;/P&gt;
&lt;P&gt;abc mb u&lt;/P&gt;
&lt;P&gt;abc cc y&lt;/P&gt;
&lt;P&gt;cba mb b&lt;/P&gt;
&lt;P&gt;cba hb y&lt;/P&gt;
&lt;P&gt;bac hb n&lt;/P&gt;
&lt;P&gt;bac hb a&lt;/P&gt;
&lt;P&gt;def cc y&lt;/P&gt;
&lt;P&gt;def cc x&lt;/P&gt;
&lt;P&gt;def cc w&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;desired output dataset should contain:&lt;/P&gt;
&lt;P&gt;abc hb y&lt;/P&gt;
&lt;P&gt;abc hb e&lt;/P&gt;
&lt;P&gt;abc mb w&lt;/P&gt;
&lt;P&gt;abc mb u&lt;/P&gt;
&lt;P&gt;bac hb n&lt;/P&gt;
&lt;P&gt;bac hb a&lt;/P&gt;
&lt;P&gt;def cc y&lt;/P&gt;
&lt;P&gt;def cc x&lt;/P&gt;
&lt;P&gt;def cc w&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just don’t know how to do an iterative compare with multiple records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2017 00:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-values-within-records-of-same-group/m-p/354638#M82983</guid>
      <dc:creator>Elliott</dc:creator>
      <dc:date>2017-04-29T00:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare values within records of same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-values-within-records-of-same-group/m-p/354662#M82991</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $4. type :$2. Code :$1.;
datalines;
abc hb y
abc hb e
abc mb w
abc mb u
abc cc y
cba mb b
cba hb y
bac hb n
bac hb a
def cc y
def cc x
def cc w
;

proc sql;
create table want as
select *
from have
group by id, type
having count(*) &amp;gt; 1;
select * from want;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Apr 2017 02:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-values-within-records-of-same-group/m-p/354662#M82991</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-29T02:59:23Z</dc:date>
    </item>
  </channel>
</rss>

