<?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: Missing records from data pull in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270177#M53641</link>
    <description>&lt;P&gt;Thank you!&amp;nbsp; I will defintely teach myself proc SQL and will use the IN&amp;nbsp;operator moving forward.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Despite there being 1,221 IDs, I didn't miss any in my copy/paste.&amp;nbsp; The IDs are all in the syntax, just not in the dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reasoin I split this into two was because when I tried to use all 1,221 in one pass, SAS gave me an error saying it could only accept 1,000.&amp;nbsp; I figured there was a solution to that but I didn't have time to look into it so went with the MERGE idea (which, obviously, did not work).&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2016 19:49:57 GMT</pubDate>
    <dc:creator>Noelle125</dc:creator>
    <dc:date>2016-05-12T19:49:57Z</dc:date>
    <item>
      <title>Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270135#M53625</link>
      <description>&lt;P&gt;Forgive me, I am a self-taught user so if I use language that is not the "norm," that's why. I'm using 9.2&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my issue.&amp;nbsp; I recently needed to pull a specific set of records from a relational database.&amp;nbsp; I needed phone numbers and addresses for customers who had made a complaint in late 2013 through the end of 2015.&amp;nbsp; &amp;nbsp;I first went into one specific table (complaints) and pulled complaint&amp;nbsp;ID numbers based on the date the complaint was received&amp;nbsp;(October 1, 2013 to December 31, 2015).&amp;nbsp;These complaint numbers are unique identifiers that reside on most,&amp;nbsp;but not all, &amp;nbsp;tables in this database.&amp;nbsp;&amp;nbsp;Because I needed data from other tables residing in the same database, I then used the complaint ID numbers to pull data from these other tables so that I would end up with the same subset of customer complaints for each additional set of data I drew.&amp;nbsp; Because there were more than 1,000 complaint IDs, I ran 999 of these IDs against the table first and&amp;nbsp;created a file (person1) and&amp;nbsp;then ran the remaining 222 IDs against the&amp;nbsp;same table to produce a second file (person2).&amp;nbsp;&amp;nbsp;When I merged person1 and person2,&amp;nbsp;I lost 41 records, i.e., 41 complaint IDs.&amp;nbsp; I can see the IDs in my syntax.&amp;nbsp; They are there but these same 41 complaints IDs and accompanying data do not show up in the resulting dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the syntax.&amp;nbsp; Because including the 1,221 IDs would make this long and cumbersome, I didn't include them.&amp;nbsp; I did reference where they resided within the syntax.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 1: This is the syntax to pull the complaint IDs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; complaintid (keep=complaint_id);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; database.complaint_vw; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; date_reported &amp;gt;= &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;'1oct2013:00:00:00'dt&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp; date_reported &amp;lt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;'31dec2015:00:00:00'dt&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; ; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; complaint_type ne &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;99&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; inactive ne &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Y'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Step 2: Using the complaint IDs from Step 1 (I exported the data into Excel then copied and pasted the complaint IDs into my syntax), I start pulling records from another table.&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; person1 (keep = case_number complaint_id person_id &lt;/FONT&gt;date_reported);&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; database.complaint;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; complaint_id = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;168&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;or complaint_id = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;174&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;or complaint_id&amp;nbsp; = &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;176&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;or complaint_id = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;177 etc. etc., 999 in&amp;nbsp;all&amp;nbsp;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; person2 (keep = case_number complaint_id person_id &lt;/FONT&gt;date_reported);&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; database.complaint;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt; &lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;complaint_id = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;678&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;or complaint_id&amp;nbsp; = &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;889&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;or complaint_id =&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;989 etc. etc., 222 in&amp;nbsp;all&amp;nbsp;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = person1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; person_id;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sort&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; = person2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; person_id;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;&lt;FONT face="Arial" size="2"&gt;Now, right here is where I lose my 41 records.&amp;nbsp; They simply do not make it through this merge.&amp;nbsp; They are in person1 before the merge.&amp;nbsp; &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; personfinal;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;merge&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; person1 person2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; person_id;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif" size="2"&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Any ideas?&amp;nbsp;&lt;/FONT&gt; &lt;FONT face="arial,helvetica,sans-serif"&gt;Thank you in advance. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 18:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270135#M53625</guid>
      <dc:creator>Noelle125</dc:creator>
      <dc:date>2016-05-12T18:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270154#M53632</link>
      <description>&lt;P&gt;I would say that about here is the start of any issue:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#ff0000" face="SAS Monospace" size="2"&gt;Step&lt;/FONT&gt; &lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;2&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;: Using the complaint IDs from Step &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; (&lt;STRONG&gt;I exported the data into Excel then copied and pasted&lt;/STRONG&gt; the complaint IDs into my syntax), I start pulling records from another &lt;/FONT&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;table.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;I suspect that a missing id or two is the most likely because of the sheer number of things you had to type.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;At this point what you are apparently looking to do is to JOIN tables on a criteria. Typically this is the work of Proc SQL after you identify the base records.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;Proc sql;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp; create table Ids as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp; select distinct complaint_id&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp; from complaintid;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;quit; /*Note QUIT is used with Sql not run*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;will generate a data set with the unique values of complaint id. If you need unique combinations of complaint_id and other variables (such as type of complaint) then&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp; select distinct complaint_id, typecomplaint&amp;nbsp;&amp;nbsp; /* note the comma, Sql uses LOTS of commas*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;Then you would join this information with another table&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;Proc Sql;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp; create table somethingcombined as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp; select b.*&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;from Ids left join someotherdataset as b on &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ids.complaint_id = b.complaint_id;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;But the question is why did you have to split the ids into two groups?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#804040" face="SAS Monospace" size="2"&gt;In the future if you find yourself doing something like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;where&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; complaint_id = &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;168&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&lt;FONT face="SAS Monospace" size="2"&gt; or complaint_id = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;174&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&lt;FONT face="SAS Monospace" size="2"&gt; or complaint_id = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;176&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;you should be aware of the IN operator to look at list of values&lt;BR /&gt;Where complaint_id in (168 174 176 ...);&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 19:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270154#M53632</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-12T19:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270164#M53634</link>
      <description>&lt;P&gt;Hi Noelle,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to make two suggestions. Feel free to use them or not:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;you can say "where complaint_id in (168, 174, 176, ...)" instead of having all the OR statements&lt;/LI&gt;&lt;LI&gt;I'd also like to suggest looking into the OUTPUT statement (See examples &lt;A href="https://v8doc.sas.com/sashtml/lgref/z0194540.htm" target="_self"&gt;here&lt;/A&gt;). You can have SAS do the sorting that you did in Excel. I suggest this because if you need the code in the future, you won't have to change all the complaint IDs you have hard-coded everywhere.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Using either would help clean up the code. They would also help make it more clear what's going on and why the results aren't how you expect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 19:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270164#M53634</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2016-05-12T19:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270165#M53635</link>
      <description>&lt;P&gt;The problem is that you were merging on person_id.&amp;nbsp; If you have one person with two complaints, they will only have one record in the personfinal dataset.&amp;nbsp; You have 41 (or fewer) people with multiple compliants.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want one record per complaint, then use a SET statement rather than a MERGE in the last DATA step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, this is an ideal application for PROC SQL.&amp;nbsp; You can do the entire combination in one step. There are some good books for learning PROC SQL.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 19:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270165#M53635</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2016-05-12T19:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270177#M53641</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; I will defintely teach myself proc SQL and will use the IN&amp;nbsp;operator moving forward.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Despite there being 1,221 IDs, I didn't miss any in my copy/paste.&amp;nbsp; The IDs are all in the syntax, just not in the dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reasoin I split this into two was because when I tried to use all 1,221 in one pass, SAS gave me an error saying it could only accept 1,000.&amp;nbsp; I figured there was a solution to that but I didn't have time to look into it so went with the MERGE idea (which, obviously, did not work).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 19:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270177#M53641</guid>
      <dc:creator>Noelle125</dc:creator>
      <dc:date>2016-05-12T19:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270179#M53642</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; I will&amp;nbsp;definitely use the IN&amp;nbsp;operator moving forward and will learn OUTPUT.&amp;nbsp;&amp;nbsp; I have done stuff like this in the past, just not this many, where I pulled data on a specific ID and those long, long lists are a pain to scroll through.&amp;nbsp; Tips like this help me a lot.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again! &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 19:53:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270179#M53642</guid>
      <dc:creator>Noelle125</dc:creator>
      <dc:date>2016-05-12T19:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270186#M53644</link>
      <description>&lt;P&gt;Interestingly, there were many people with multiple complaints.&amp;nbsp; It might be 41 or fewer but I had this happen - one person had six&amp;nbsp;complaints within my designated timeframe but only five of the six complaints&amp;nbsp;showed up after the merge.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the meantime, I will try using SET but&amp;nbsp;it really sounds like proc SQL is what I need to learn.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 20:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270186#M53644</guid>
      <dc:creator>Noelle125</dc:creator>
      <dc:date>2016-05-12T20:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270190#M53646</link>
      <description>&lt;P&gt;Here's another reason to learn SQL.&amp;nbsp; Consider all the work you did pulling the data into Excel, formatting the WHERE condition ... compared with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table person1 as select case_number, complaint_id, person_id, date_reported from database.complaint&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; where complaint_id in (select distinct complaint_id from COMPLAINT_ID);&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My SQL isn't great, so it's possible you will need to debug this.&amp;nbsp; But SQL makes it easy to extract from one data set based on extracted data from another data set.&amp;nbsp; (Just to differentiate, COMPLAINT_ID in uppercase is the data set name, while complaint_id in lowercase is the variable name.&amp;nbsp; SAS won't care about upper vs. lower case in this example.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 20:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270190#M53646</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-12T20:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270212#M53653</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; &amp;nbsp;I'm on Amazon right now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 21:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270212#M53653</guid>
      <dc:creator>Noelle125</dc:creator>
      <dc:date>2016-05-12T21:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270213#M53654</link>
      <description>&lt;P&gt;Here is an example showing how some complaint IDs from dataset PERSON1 were lost (more precisely: were&lt;EM&gt; overwritten&lt;/EM&gt;) due to the inappropriate MERGE by person ID (as pointed out by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13604"&gt;@Doc_Duke﻿&lt;/a&gt;)&lt;FONT face="arial,helvetica,sans-serif"&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data p1;
input complaint_id person_id;
cards;
12 1
34 1
45 2
56 2
60 3
;

data p2;
input complaint_id person_id;
cards;
72 1
80 1
84 2
97 3
;

data p_final;
merge p1 p2;
by person_id; /* strongly discouraged! */
run;

proc print data=p_final noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The number of distinct complaint IDs drops from 9 to 5. Maybe the following log messages (from the MERGE step) could have warned you:&lt;/P&gt;
&lt;PRE&gt;INFO: The variable complaint_id on data set WORK.P1 will be overwritten by data set WORK.P2.
NOTE: MERGE statement has more than one data set with repeats of BY values.&lt;/PRE&gt;
&lt;P&gt;Only "maybe", because the INFO message is printed only if system option MSGLEVEL is set to I (or i), which I recommend:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options msglevel=I;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the NOTE is triggered only by cases where duplicate key values (here: person_id values) occur in both datasets &lt;EM&gt;in the same BY group&lt;/EM&gt; (i.e. with the same person_id) as is the case for person_id 1 in the above example. The other two person IDs demonstrate that this is not the only situation where complaint IDs are overwritten.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 21:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270213#M53654</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-12T21:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Missing records from data pull</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270217#M53656</link>
      <description>&lt;P&gt;Thank you so very much for the explanation of what probably happened.&amp;nbsp; The solutions will help me moving forward but I was still wondering why merge didn't work in the first place so thank you for this. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I'm going to set that message level to I and see what happens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again!&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 21:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-records-from-data-pull/m-p/270217#M53656</guid>
      <dc:creator>Noelle125</dc:creator>
      <dc:date>2016-05-12T21:38:40Z</dc:date>
    </item>
  </channel>
</rss>

