<?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: Left Join Issue in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69340#M19912</link>
    <description>As Patrick stated you are filtering in the wrong place.  This code will work for you.&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
Select a.pid, b.access&lt;BR /&gt;
From project a LEFT JOIN (select * from UserPrjAccess where Userid = 1 ) b on (a.pid = b.pid)&lt;BR /&gt;
&lt;BR /&gt;
;&lt;BR /&gt;
quit ;</description>
    <pubDate>Fri, 19 Mar 2010 12:06:22 GMT</pubDate>
    <dc:creator>Flip</dc:creator>
    <dc:date>2010-03-19T12:06:22Z</dc:date>
    <item>
      <title>Left Join Issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69336#M19908</link>
      <description>I'm using the following sql to try and get back my data in a specific way.&lt;BR /&gt;
I want a list of my projects and a access level next to each project that the user has access.  If he doesn't I want a missing value. This is the code I am using and it only returns back rows where the pid's are equal like an inner join.&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
Select a.pid, b.access&lt;BR /&gt;
From project a LEFT JOIN UserPrjAccess b on (a.pid = b.pid)&lt;BR /&gt;
where b.Userid = 1&lt;BR /&gt;
;&lt;BR /&gt;
quit ;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I need the output like this&lt;BR /&gt;
Output dataset &lt;BR /&gt;
Proj1  01&lt;BR /&gt;
Proj2  02&lt;BR /&gt;
Proj3  .&lt;BR /&gt;
Proj4  .&lt;BR /&gt;
Proj5  01&lt;BR /&gt;
&lt;BR /&gt;
I know i'm missing something basic but I can't find it.&lt;BR /&gt;
&lt;BR /&gt;
Thank you for any help</description>
      <pubDate>Thu, 18 Mar 2010 16:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69336#M19908</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2010-03-18T16:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69337#M19909</link>
      <description>Suggest you also share an input data example, possibly using instream data-points (DATA steps using DATALINES along with requisite INPUT statement) for both of your files WORK.Project and WORK.UserPrjAccess.  Also, the WHERE clause is testing a numeric value of 1 - for what purpose in this exercise -- is that an individual's USERID?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Recommended Google advanced search argument, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
proc sql join processing site:sas.com</description>
      <pubDate>Thu, 18 Mar 2010 18:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69337#M19909</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-18T18:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69338#M19910</link>
      <description>The where clause filters the result set (and not the input table).&lt;BR /&gt;
&lt;BR /&gt;
Userid will be NULL for all non-matching records - and therefore get filtered.&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Thu, 18 Mar 2010 18:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69338#M19910</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-03-18T18:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69339#M19911</link>
      <description>Scott,&lt;BR /&gt;
Sorry for my question not being as detailed.  I will make sure to be more detailed in any post.&lt;BR /&gt;
&lt;BR /&gt;
Patrick that was it.  &lt;BR /&gt;
&lt;BR /&gt;
Thank you to both.&lt;BR /&gt;
&lt;BR /&gt;
Jerry</description>
      <pubDate>Thu, 18 Mar 2010 18:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69339#M19911</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2010-03-18T18:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69340#M19912</link>
      <description>As Patrick stated you are filtering in the wrong place.  This code will work for you.&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
Select a.pid, b.access&lt;BR /&gt;
From project a LEFT JOIN (select * from UserPrjAccess where Userid = 1 ) b on (a.pid = b.pid)&lt;BR /&gt;
&lt;BR /&gt;
;&lt;BR /&gt;
quit ;</description>
      <pubDate>Fri, 19 Mar 2010 12:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Left-Join-Issue/m-p/69340#M19912</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-03-19T12:06:22Z</dc:date>
    </item>
  </channel>
</rss>

