<?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: outer join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/outer-join/m-p/268515#M53157</link>
    <description>&lt;P&gt;Are you looking for a report or a SAS dataset?&amp;nbsp; The DATA step is generating a SAS dataset and the SQL is just generating a report.&amp;nbsp; If you tried to create a dataset from the SQL, you would need to rename test2.code to something else to get two 'code' columns.&amp;nbsp; You could accomplish the same thing in test2 with an assignment statement (essentially duplicating test2.code with a different name).&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2016 13:46:58 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2016-05-05T13:46:58Z</dc:date>
    <item>
      <title>outer join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outer-join/m-p/268504#M53153</link>
      <description>&lt;P&gt;Hi&amp;nbsp;All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting some issue while outer join the tables. Please help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 2 data set (test1) and (test2). In test1 ther is 2 columns and in test2 there is 1 column only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want to put outer join on both of the tables. I want it should display all the records from test1 and where code is not matching it should blank for code. &amp;nbsp;see below is my code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test1;&lt;BR /&gt;input name $ code $;&lt;BR /&gt;datalines;&lt;BR /&gt;RAHUL A12345&lt;BR /&gt;RAJ A45678&lt;BR /&gt;ROC A12345&lt;BR /&gt;MOHAN KJ7652&lt;BR /&gt;SOHAN M23456&lt;BR /&gt;ROHAN N87654&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test2;&lt;BR /&gt;input code$;&lt;BR /&gt;datalines;&lt;BR /&gt;A12345&lt;BR /&gt;A45678&lt;BR /&gt;KJ7652&lt;BR /&gt;KK8765&lt;BR /&gt;PK9876&lt;BR /&gt;QU6543&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=test1;&lt;BR /&gt;by code;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=test2;&lt;BR /&gt;by code;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data test3;&lt;BR /&gt;merge test1 (keep=_all_ in=a)&lt;BR /&gt; test2 (keep =code in=b);&lt;BR /&gt;by code;&lt;BR /&gt;if (a);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want the output which is displaying in below proc sql.Please help how I can get both the code values in data step&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select a.name,a.code,b.code&lt;BR /&gt;from test1 as a left outer join test2 as b&lt;BR /&gt;on a.code=b.code;&lt;BR /&gt;quit&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 13:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outer-join/m-p/268504#M53153</guid>
      <dc:creator>CG1</dc:creator>
      <dc:date>2016-05-05T13:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: outer join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outer-join/m-p/268515#M53157</link>
      <description>&lt;P&gt;Are you looking for a report or a SAS dataset?&amp;nbsp; The DATA step is generating a SAS dataset and the SQL is just generating a report.&amp;nbsp; If you tried to create a dataset from the SQL, you would need to rename test2.code to something else to get two 'code' columns.&amp;nbsp; You could accomplish the same thing in test2 with an assignment statement (essentially duplicating test2.code with a different name).&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 13:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outer-join/m-p/268515#M53157</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2016-05-05T13:46:58Z</dc:date>
    </item>
  </channel>
</rss>

