<?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: Losing observations when doing a left outer join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Losing-observations-when-doing-a-left-outer-join/m-p/280060#M56535</link>
    <description>&lt;P&gt;Thanks! I ran a proc contents and got the smaller number. I'd gotten the larger number in the log after a proc sort.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2016 20:07:56 GMT</pubDate>
    <dc:creator>janet0102</dc:creator>
    <dc:date>2016-06-24T20:07:56Z</dc:date>
    <item>
      <title>Losing observations when doing a left outer join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-observations-when-doing-a-left-outer-join/m-p/280041#M56528</link>
      <description>&lt;P&gt;I need to join all the variables in one dataset (caper10.caperfy10_selectvar; 17,407,272 obs) with specified variables in a 2nd dataset (temp1.fy1011_pnpts_enddate; 62,451 obs and no duplicates). I've done this with multiple tables and have never lost observations, but this time the joined dataset has 16,4999,282 obs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My syntax is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;create table left_outer_join as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; select *&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from caper10.caperfy10_selectvar as a left join&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;temp1.fy1011_pnpts_enddate (keep = patssn paindate pnid enddate diag patssn1) as b&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; on a.sponssn = b.patssn;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both sponssn and patssn are character variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insight into why this is happening will be greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4, 64 bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Janet&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 17:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-observations-when-doing-a-left-outer-join/m-p/280041#M56528</guid>
      <dc:creator>janet0102</dc:creator>
      <dc:date>2016-06-24T17:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Losing observations when doing a left outer join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-observations-when-doing-a-left-outer-join/m-p/280057#M56534</link>
      <description>&lt;P&gt;As far as I can tell, this should not append. How did you get the number of obs in&amp;nbsp;&lt;SPAN&gt;caper10.caperfy10_selectvar? One possible explanation: Some (most, all?) databases do not remove deleted obs, they only mark them as "deleted". SAS is no exception. The count of records in a data table given by &lt;STRONG&gt;dictionary.tables&lt;/STRONG&gt; field &lt;EM&gt;nobs&lt;/EM&gt;&amp;nbsp;can be superior to the count of logical records (&lt;EM&gt;nlobs&lt;/EM&gt;) because some records have been deleted.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 19:56:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-observations-when-doing-a-left-outer-join/m-p/280057#M56534</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-24T19:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Losing observations when doing a left outer join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-observations-when-doing-a-left-outer-join/m-p/280060#M56535</link>
      <description>&lt;P&gt;Thanks! I ran a proc contents and got the smaller number. I'd gotten the larger number in the log after a proc sort.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 20:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-observations-when-doing-a-left-outer-join/m-p/280060#M56535</guid>
      <dc:creator>janet0102</dc:creator>
      <dc:date>2016-06-24T20:07:56Z</dc:date>
    </item>
  </channel>
</rss>

