<?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: evaluate if observations is two time in the dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310648#M67026</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105303"&gt;@mariange8282&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I'm obtained a error because my dataset have two equal observations. I need to delete it is thats the case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_LABEL_ X1 X2 X3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; 2 &amp;nbsp; 3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs2 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; 5 &amp;nbsp; 6&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp;8 &amp;nbsp;9&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp;5 &amp;nbsp;6&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to delete Obs1 because its repeat&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since the "Obs1" observations contain different data in the other columns, the question arises: which values need to be kept?&lt;/P&gt;
&lt;P&gt;Simply sorting away with nodupkey might lose valuable information.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Nov 2016 13:16:30 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-11-10T13:16:30Z</dc:date>
    <item>
      <title>evaluate if observations is two time in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310640#M67020</link>
      <description>&lt;P&gt;Hi, I'm obtained a error because my dataset have two equal observations. I need to delete it is thats the case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_LABEL_ X1 X2 X3&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; 2 &amp;nbsp; 3&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs2 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; 5 &amp;nbsp; 6&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp;8 &amp;nbsp;9&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs3 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp;5 &amp;nbsp;6&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to delete Obs1 because its repeat&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 12:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310640#M67020</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-11-10T12:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate if observations is two time in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310642#M67022</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input _LABEL_ $ X1 X2 X3;
   datalines;
Obs1 1 2 3 
Obs2 4 5 6 
Obs1 7 8 9 
Obs3 4 5 6 
;

proc sort data = have;
   by _LABEL_;
run;

data want;
   set have;
   by _LABEL_;
   if first._LABEL_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Nov 2016 12:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310642#M67022</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2016-11-10T12:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate if observations is two time in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310643#M67023</link>
      <description>&lt;P&gt;Or do you need to delete both Obs1 observations?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 12:41:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310643#M67023</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2016-11-10T12:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate if observations is two time in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310644#M67024</link>
      <description>&lt;P&gt;In that case&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   by _LABEL_;
   if first._LABEL_ = last._LABEL_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Nov 2016 12:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310644#M67024</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2016-11-10T12:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate if observations is two time in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310648#M67026</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105303"&gt;@mariange8282&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I'm obtained a error because my dataset have two equal observations. I need to delete it is thats the case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_LABEL_ X1 X2 X3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; 2 &amp;nbsp; 3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs2 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; 5 &amp;nbsp; 6&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp;8 &amp;nbsp;9&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp;5 &amp;nbsp;6&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to delete Obs1 because its repeat&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since the "Obs1" observations contain different data in the other columns, the question arises: which values need to be kept?&lt;/P&gt;
&lt;P&gt;Simply sorting away with nodupkey might lose valuable information.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 13:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310648#M67026</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-10T13:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate if observations is two time in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310649#M67027</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
   input _LABEL_ $ X1 X2 X3;
   datalines;
Obs1 1 2 3 
Obs2 4 5 6 
Obs1 7 8 9 
Obs3 4 5 6 
;
run;

data want;
if _n_=1 then
 do;
 	declare hash h(dataset:"have", multidata :'Y');
	h.definekey('_LABEL_');
	h.definedata(all:'YES');
	h.definedone();
 end;

do until (last);
  set have end=last;
  rc=h.find();
  if h.find_next() ne 0 then output;
end;

drop rc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Nov 2016 13:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310649#M67027</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-11-10T13:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate if observations is two time in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310922#M67098</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
   input _LABEL_ $ X1 X2 X3;
   datalines;
Obs1 1 2 3 
Obs2 4 5 6 
Obs1 7 8 9 
Obs3 4 5 6 
;
run;

data want;
if _n_=1 then do;
 if 0 then set have;
 	declare hash h();
	h.definekey('_LABEL_');
	h.definedone();
end;
set have ;
if h.check()=0 then delete;
 else h.add();
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Nov 2016 11:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/evaluate-if-observations-is-two-time-in-the-dataset/m-p/310922#M67098</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-11T11:21:21Z</dc:date>
    </item>
  </channel>
</rss>

