<?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 records with identical variable values. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76141#M16445</link>
    <description>You mean BY X, I suppose?&lt;BR /&gt;
&lt;BR /&gt;
IF FIRST.X=0 OR LAST.X=0;</description>
    <pubDate>Mon, 19 Oct 2009 08:33:24 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-19T08:33:24Z</dc:date>
    <item>
      <title>Find records with identical variable values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76139#M16443</link>
      <description>Table variables NR and X. I want to keep the records for each NR, where the values of X are identical.&lt;BR /&gt;
&lt;BR /&gt;
From&lt;BR /&gt;
&lt;BR /&gt;
NR X&lt;BR /&gt;
10 1&lt;BR /&gt;
10 2&lt;BR /&gt;
10 2&lt;BR /&gt;
10 3&lt;BR /&gt;
10 4&lt;BR /&gt;
10 4&lt;BR /&gt;
10 4&lt;BR /&gt;
10 5&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
I would like to get&lt;BR /&gt;
&lt;BR /&gt;
NR X&lt;BR /&gt;
10 2&lt;BR /&gt;
10 2&lt;BR /&gt;
10 4&lt;BR /&gt;
10 4&lt;BR /&gt;
10 4&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
How can that be done in a data step?</description>
      <pubDate>Mon, 19 Oct 2009 08:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76139#M16443</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-19T08:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Find records with identical variable values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76140#M16444</link>
      <description>You could use SET with BY nr, then using first. and last. logic in a subsetting IF statement.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 19 Oct 2009 08:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76140#M16444</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-10-19T08:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Find records with identical variable values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76141#M16445</link>
      <description>You mean BY X, I suppose?&lt;BR /&gt;
&lt;BR /&gt;
IF FIRST.X=0 OR LAST.X=0;</description>
      <pubDate>Mon, 19 Oct 2009 08:33:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76141#M16445</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-19T08:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Find records with identical variable values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76142#M16446</link>
      <description>Yes, I was a bit quick.&lt;BR /&gt;
It should be&lt;BR /&gt;
&lt;BR /&gt;
BY nr x;&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 19 Oct 2009 09:52:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76142#M16446</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-10-19T09:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Find records with identical variable values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76143#M16447</link>
      <description>Here is how I would handle this (I do it all the time for data validation purposes)&lt;BR /&gt;
--------------------------------------------&lt;BR /&gt;
data test;&lt;BR /&gt;
  input NR X;&lt;BR /&gt;
cards;&lt;BR /&gt;
10 1&lt;BR /&gt;
10 2&lt;BR /&gt;
10 2&lt;BR /&gt;
10 3&lt;BR /&gt;
10 4&lt;BR /&gt;
10 4&lt;BR /&gt;
10 4&lt;BR /&gt;
10 5&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=test;&lt;BR /&gt;
  by NR X;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data dups;&lt;BR /&gt;
  set test;&lt;BR /&gt;
  by NR X;&lt;BR /&gt;
  if not(first.X and last.X);&lt;BR /&gt;
run;

Message was edited by: Curtis Mack</description>
      <pubDate>Tue, 20 Oct 2009 14:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-records-with-identical-variable-values/m-p/76143#M16447</guid>
      <dc:creator>CurtisMack</dc:creator>
      <dc:date>2009-10-20T14:43:54Z</dc:date>
    </item>
  </channel>
</rss>

