<?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: Select records that are NOT in another dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104928#M258428</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sometimes on my browser I log onto a discussion that I started and the "Correct Answer" and "Helpful Answer" links are not available.&amp;nbsp; In other words, there is no way for me to mark your response as correct or to close the discussion.&amp;nbsp; The only thing I can do is visit the discussion at a later date and hope the "Correct Answer" link has reappeared. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So that is what I did this time.&amp;nbsp; I visited the discussion on Feb 11 and I couldn't mark Patrick's response as correct.&amp;nbsp; I came back the next day and it was there, so now I have marked it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Feb 2013 19:29:18 GMT</pubDate>
    <dc:creator>AD</dc:creator>
    <dc:date>2013-02-12T19:29:18Z</dc:date>
    <item>
      <title>Select records that are NOT in another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104923#M258423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hey, I've got a dataset that I need to randomly split into two groups (i.e., datasets) of unequal size.&amp;nbsp; For example, I have a dataset (RatersAll) with 13 raters (RaterID = 1, 2, 3,..., 13), and I need to randomly select 8 of them to be put into one dataset (Raters1) and the remaining 5 to be put into another (Raters2).&amp;nbsp; My thoughts were to use Proc Surveyselect to randomly select the first 8 raters.&amp;nbsp; Then I was going to use Proc SQL to put the remaining raters in the second dataset.&amp;nbsp; My code is below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc SurveySelect&amp;nbsp; Data=RatersAll Method=SRS &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Rep=1 Sampsize=8 Seed=0 Out=Raters1;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Proc SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Create Table Raters2 As&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select t1.RaterID &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; From RatersAll t1,&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; Raters1 t2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where t1.RaterID &amp;lt;&amp;gt; t2.RaterID&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Proc Surveyselect code does exactly what I want.&amp;nbsp; My SQL code, however, returns way too many records.&amp;nbsp; I just want it to return the raters that were not selected in the surveyselect code.&amp;nbsp; I'm also open to other suggestions that make this whole process more efficient.&amp;nbsp; Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andy &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 03:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104923#M258423</guid>
      <dc:creator>AD</dc:creator>
      <dc:date>2013-02-11T03:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Select records that are NOT in another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104924#M258424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below a SQL syntax which should give you the correct result. I've also added a data step version which should perform more efficiently in case your data set RatersAll contains a lot of observations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data RatersAll;&lt;BR /&gt;&amp;nbsp; set sashelp.class;&lt;BR /&gt;&amp;nbsp; RaterID=_n_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Proc SurveySelect&amp;nbsp; Data=RatersAll Method=SRS &lt;BR /&gt;&amp;nbsp; Rep=1 Sampsize=8 Seed=0 Out=Raters1;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* SQL version */&lt;BR /&gt;Proc SQL;&lt;BR /&gt;&amp;nbsp; Create Table Raters2 As&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select t1.* &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; From RatersAll t1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where t1.RaterID not in (select RaterID from Raters1)&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* data step version */&lt;BR /&gt;data Raters2_DataStep;&lt;BR /&gt;&amp;nbsp; set RatersAll;&lt;BR /&gt;&amp;nbsp; if _n_=1 then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; declare hash h1 (dataset:'Raters1',hashexp:4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _rc=h1.defineKey('RaterID');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _rc=h1.defineDone();&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; if h1.check() then output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S:&lt;/P&gt;&lt;P&gt;For SQL there is also a EXCEPT operator which would work in your case. Here the docu with example &lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#p1o6k7t8y56hobn1mup90vpf4ye6.htm" title="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#p1o6k7t8y56hobn1mup90vpf4ye6.htm"&gt;SAS(R) 9.3 SQL Procedure User's Guide&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 09:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104924#M258424</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-02-11T09:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select records that are NOT in another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104925#M258425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, this is great!&amp;nbsp; I will mark your answer as "correct" as soon as the option appears, but it doesn't seem to be available right now.&amp;nbsp; This happened one other time, but after a week, the option became available. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a side note, I also stumbled across the "Outall" option in Proc Surveyselect, which does everything I'm looking for as well. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 14:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104925#M258425</guid>
      <dc:creator>AD</dc:creator>
      <dc:date>2013-02-11T14:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select records that are NOT in another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104926#M258426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which "option" are you talking about? I don't know Proc Surveyselect very well. So great that there is already an option which does what you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be good if you could somehow mark your thread as answered so that it gets "closed".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 11:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104926#M258426</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-02-12T11:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select records that are NOT in another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104927#M258427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think OP was referring the "Option" of marking your answer as "Correct". &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 14:29:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104927#M258427</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-02-12T14:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select records that are NOT in another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104928#M258428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sometimes on my browser I log onto a discussion that I started and the "Correct Answer" and "Helpful Answer" links are not available.&amp;nbsp; In other words, there is no way for me to mark your response as correct or to close the discussion.&amp;nbsp; The only thing I can do is visit the discussion at a later date and hope the "Correct Answer" link has reappeared. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So that is what I did this time.&amp;nbsp; I visited the discussion on Feb 11 and I couldn't mark Patrick's response as correct.&amp;nbsp; I came back the next day and it was there, so now I have marked it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 19:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-records-that-are-NOT-in-another-dataset/m-p/104928#M258428</guid>
      <dc:creator>AD</dc:creator>
      <dc:date>2013-02-12T19:29:18Z</dc:date>
    </item>
  </channel>
</rss>

