<?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: prob in left join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198762#M37258</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no,, that are already unique...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Mar 2015 11:08:17 GMT</pubDate>
    <dc:creator>Aman4SAS</dc:creator>
    <dc:date>2015-03-11T11:08:17Z</dc:date>
    <item>
      <title>prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198758#M37254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am having issue with one of my sql query where i m getting same result using inner join and left join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table reps_act_details as&lt;BR /&gt;select distinct a.mud_id ,a.rep_id ,c.indi_id ,c.evtype ,c.detpos ,c.DETPROD ,c.yrmo ,c.event_date&lt;BR /&gt;from reps1 a &lt;BR /&gt;left join&lt;BR /&gt;dw.sas_indi_calls c&lt;BR /&gt;on a.rep_id=c.rep_id&lt;BR /&gt;where c.yrmo between 201411 and 201502 and evtype = "C" ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i m getting only common one .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz suggest&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 07:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198758#M37254</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2015-03-11T07:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198759#M37255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have a match for every record of reps1 in dw.sas_indi_calls, left and inner joins produce the same result. Only if some matches are missing from the second dataset will an inner join produce less records.&lt;/P&gt;&lt;P&gt;And if you have more than one match in the second dataset, you will get one record per match in the output dataset, increasing the number of records from the first input dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 09:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198759#M37255</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T09:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198760#M37256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have 431 rep_id in reps1 dataset and 10000 of reps in sas_indi_calls dataset, and i want result only for 431 reps which are available in reps1 dataset. it doesnt matter they are avalible in sas_indi_calls dataset ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but i m getting 429 rep_id..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz suggest..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 10:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198760#M37256</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2015-03-11T10:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198761#M37257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably have a repeat of rep_id in reps1, which is canceled out with the distinct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 11:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198761#M37257</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T11:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198762#M37258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no,, that are already unique...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 11:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198762#M37258</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2015-03-11T11:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198763#M37259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then it's probably coming from&lt;/P&gt;&lt;P&gt;where c.yrmo between 201411 and 201502 and evtype = "C" ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 11:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198763#M37259</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T11:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198764#M37260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but i need to put these conditions too, is there anyway to get my desired output with these conditions. , when i m using merge then i m getting my desired output,,, so is it possible with proc sql?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 11:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198764#M37260</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2015-03-11T11:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198765#M37261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Inspect your data. Make subsets and see which subset shows the same effect. Play around with the condition(s) until you get a clue what causes the effect.&lt;/P&gt;&lt;P&gt;Unless you want to post your .sas7bdat files here for testing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 11:43:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198765#M37261</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T11:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198766#M37262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Having where clause on the right table in a left join can give you what can seem unpredictable results. Have the where in a previous step or in an in line view, depending on what you want to achieve. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 20:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198766#M37262</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-03-12T20:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198767#M37263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;You can make a table with only the list of reps you want, this will not have anything other than the reps, then you can do outer joins to the tables you are using with the conditions. This will give you two result tables both containing the reps you need and null data, except rep id's, for missing data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since both of the tables have been prequalified, then you can join them and get the result you seek. (yes, ugly and messy way of it.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 20:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198767#M37263</guid>
      <dc:creator>morgalr</dc:creator>
      <dc:date>2015-03-12T20:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198768#M37264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The WHERE clause is applied to the result of the join. When there is no match in the right table, the WHERE condition is always false. As &lt;A __default_attr="119192" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt;&amp;nbsp; suggested, you can use an inline query as your right table :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;create table reps_act_details as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select distinct a.mud_id , a.rep_id , c.indi_id , c.evtype , c.detpos , c.DETPROD , c.yrmo , c.event_date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;from &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; reps1 as a left join&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; (select * from dw.sas_indi_calls where yrmo between 201411 and 201502 and evtype = "C") as c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;on a.rep_id=c.rep_id ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That way, the condition is applied before the join is performed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 22:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198768#M37264</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-03-12T22:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: prob in left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198769#M37265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the WHERE to AND to make the additional condition part of what determines if the value from the right hand table meets the join criteria.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 23:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prob-in-left-join/m-p/198769#M37265</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-12T23:31:43Z</dc:date>
    </item>
  </channel>
</rss>

