<?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: Nodupkey using a where statement in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118610#M32724</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sort first descending by lat then use nodupkey. This will push the observations with values before the ones with 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have; by id descending lat;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have nodupkey; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Apr 2013 14:24:46 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-04-24T14:24:46Z</dc:date>
    <item>
      <title>Nodupkey using a where statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118609#M32723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI &lt;/P&gt;&lt;P&gt;i have a table that has duplicate entries here is and example.&lt;/P&gt;&lt;P&gt;ID.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lat.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Long&lt;/P&gt;&lt;P&gt;001.&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;001.&amp;nbsp;&amp;nbsp;&amp;nbsp; 33.4.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -112.221&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would want to remove the duplicate that has 0 for lat and long and keep the entry&amp;nbsp; where there is a lat and long.&lt;/P&gt;&lt;P&gt;here is&amp;nbsp; a snippet of what I'm using &lt;/P&gt;&lt;P&gt;proc sort data= table1&lt;/P&gt;&lt;P&gt;out=table1&lt;/P&gt;&lt;P&gt;nodupkey;&lt;/P&gt;&lt;P&gt;where lat &amp;lt;&amp;gt; 0;&lt;/P&gt;&lt;P&gt;by&amp;nbsp; ID;&lt;/P&gt;&lt;P&gt;which works except it also removes some id&amp;nbsp; that's are not dups&amp;nbsp; but have a 0 in the lat and long columns ....thanks again for assistance &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 14:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118609#M32723</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2013-04-24T14:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Nodupkey using a where statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118610#M32724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sort first descending by lat then use nodupkey. This will push the observations with values before the ones with 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have; by id descending lat;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have nodupkey; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 14:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118610#M32724</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-24T14:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nodupkey using a where statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118611#M32725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The possibility of negative values can make this tricky.&amp;nbsp; If you can guarantee that each ID has at most one record with all 0s, here's a way to do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; merge have (where=(lat=0 and long=0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have (where=(lat ne 0 or long ne 0));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 14:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118611#M32725</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-04-24T14:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nodupkey using a where statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118612#M32726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;True, but latitude and longitude have very well defined transition points to negative/positive. If I'm dealing with Canadian data for example, I know that all my latitudes will be positive.&lt;/P&gt;&lt;P&gt;For countries that cross boundaries another solution would be required. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 14:49:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118612#M32726</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-24T14:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Nodupkey using a where statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118613#M32727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
input ID&amp;nbsp;&amp;nbsp; $&amp;nbsp;&amp;nbsp; Lat&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Long ;
cards;
001.&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0
001.&amp;nbsp;&amp;nbsp;&amp;nbsp; 33.4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -112.221
002.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0
;
run;
proc sort data=have;
&amp;nbsp;&amp;nbsp; by id;
run;
data want;
 set have;
 by id;
 if&amp;nbsp; lat = 0 and not(first.id and last.id) then delete;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 15:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nodupkey-using-a-where-statement/m-p/118613#M32727</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-04-24T15:02:37Z</dc:date>
    </item>
  </channel>
</rss>

