<?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: proc sql left join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-left-join/m-p/121151#M24829</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me try to guess and at least give you a starting point :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;create table WANT as select &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;A.*, B.VAR4, B.VAR5&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;From DATA1 as A left join DATA2 as B&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on A.VAR1=B.VAR1 and A.VAR2=B.VAR2 and A.year=B.year&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WHERE A.year between 1993 and 2000&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;order by VAR1, year;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select * from WANT;&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;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Apr 2013 00:19:39 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2013-04-26T00:19:39Z</dc:date>
    <item>
      <title>proc sql left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-left-join/m-p/121149#M24827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, all&lt;/P&gt;&lt;P&gt;I want to merge to datasets&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data1 has VAR1 VAR2 VAR3 year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data2 has VAR1 VAR2 VAR4 VAR 5 year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use proc sql left join data1 with data2 with the following conditions :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data1.var1=data2.var1&lt;/P&gt;&lt;P&gt;1993&amp;lt;year&amp;lt;2000&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;i got error using the code below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table WANT as select &lt;BR /&gt;A.*, B.*&lt;BR /&gt;From DATA1 as A left join DATA2 as B&lt;BR /&gt;WHERE 1993&amp;lt;=YEAR&amp;lt;=2000&lt;BR /&gt;On A.VAR1 =B.VAR2 &lt;BR /&gt;order by VAR1, year;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help and Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 23:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-left-join/m-p/121149#M24827</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-04-25T23:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-left-join/m-p/121150#M24828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which of the two YEAR variables do you want to subset on?&lt;/P&gt;&lt;P&gt;Perhaps you want to add the condition that A.year = B.year ?&amp;nbsp; &lt;/P&gt;&lt;P&gt;Since you are doing a LEFT JOIN perhaps you want to subset on A.year ? Or perhaps both?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 23:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-left-join/m-p/121150#M24828</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-04-25T23:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-left-join/m-p/121151#M24829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me try to guess and at least give you a starting point :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;create table WANT as select &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;A.*, B.VAR4, B.VAR5&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;From DATA1 as A left join DATA2 as B&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on A.VAR1=B.VAR1 and A.VAR2=B.VAR2 and A.year=B.year&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WHERE A.year between 1993 and 2000&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;order by VAR1, year;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select * from WANT;&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;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2013 00:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-left-join/m-p/121151#M24829</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-04-26T00:19:39Z</dc:date>
    </item>
  </channel>
</rss>

