<?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: Creating two new variables by comparing the obs in two tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618187#M181308</link>
    <description>&lt;P&gt;Are you asking for an inner join?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
infile cards truncover;
input INST	FAC_NUM;
cards;
4265	948
4266	948
;

data have2;
input INST_AM	INST_AT	FAC_NUM;
cards;
4265	4266	948
;

proc sql;
create table want as
select a.*,INST_AT
from have1 a,have2 b
where a.inst=b.inst_am and a.fac_num=b.fac_num;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 17 Jan 2020 19:42:33 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-01-17T19:42:33Z</dc:date>
    <item>
      <title>Creating two new variables by comparing the obs in two tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618186#M181307</link>
      <description>&lt;P&gt;Can Someone please advise how I can get the final output using Table 1 and Table 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thankyou&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 19:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618186#M181307</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2020-01-17T19:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating two new variables by comparing the obs in two tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618187#M181308</link>
      <description>&lt;P&gt;Are you asking for an inner join?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
infile cards truncover;
input INST	FAC_NUM;
cards;
4265	948
4266	948
;

data have2;
input INST_AM	INST_AT	FAC_NUM;
cards;
4265	4266	948
;

proc sql;
create table want as
select a.*,INST_AT
from have1 a,have2 b
where a.inst=b.inst_am and a.fac_num=b.fac_num;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2020 19:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618187#M181308</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-17T19:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating two new variables by comparing the obs in two tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618189#M181309</link>
      <description>&lt;P&gt;Thankyou but I need two columns the INST_AT as well so how would I modify the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I need to have the repeated row deleted and get the final output as in the EXCEl&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select a.*,INST_AM,INST_AT&lt;BR /&gt;from new a,inst_trans b&lt;BR /&gt;where a.id=b.inst_am and a.fac_num=b.fac_num&lt;BR /&gt;or a.id=b.inst_at and a.fac_num=b.fac_num ;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 19:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618189#M181309</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2020-01-17T19:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating two new variables by comparing the obs in two tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618191#M181310</link>
      <description>&lt;P&gt;Not sure what you are saying. When i ran -&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select a.*,INST_AT
from have1 a,have2 b
where a.inst=b.inst_am and a.fac_num=b.fac_num;
quit;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get this.&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;INST&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;FAC_NUM&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;INST_AT&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;4265&lt;/TD&gt;
&lt;TD class="r data"&gt;948&lt;/TD&gt;
&lt;TD class="r data"&gt;4266&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 17 Jan 2020 20:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-two-new-variables-by-comparing-the-obs-in-two-tables/m-p/618191#M181310</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-17T20:11:35Z</dc:date>
    </item>
  </channel>
</rss>

