<?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 Proc SQL join?  Maybe inner? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/590952#M169220</link>
    <description>&lt;P&gt;Hello, experts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two datasets.&amp;nbsp; &amp;nbsp;Dataset1 contains 10K obs and 1000 variables, including IDs, Status, etc.&amp;nbsp; &amp;nbsp;Dataset2 contains 100 obs and two variables, IDs and Status.&amp;nbsp; &amp;nbsp;I would like to merge the updated 'Status' in Dataset2 to Dataset1, by same IDs.&amp;nbsp; &amp;nbsp; The IDs are characters, and the Status is numeric.&amp;nbsp; &amp;nbsp; I think I could use Proc SQL join to merge, but not sure which join is best and which dataset should put first?&amp;nbsp; Please advice.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2019 14:48:42 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2019-09-23T14:48:42Z</dc:date>
    <item>
      <title>Proc SQL join?  Maybe inner?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/590952#M169220</link>
      <description>&lt;P&gt;Hello, experts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two datasets.&amp;nbsp; &amp;nbsp;Dataset1 contains 10K obs and 1000 variables, including IDs, Status, etc.&amp;nbsp; &amp;nbsp;Dataset2 contains 100 obs and two variables, IDs and Status.&amp;nbsp; &amp;nbsp;I would like to merge the updated 'Status' in Dataset2 to Dataset1, by same IDs.&amp;nbsp; &amp;nbsp; The IDs are characters, and the Status is numeric.&amp;nbsp; &amp;nbsp; I think I could use Proc SQL join to merge, but not sure which join is best and which dataset should put first?&amp;nbsp; Please advice.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 14:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/590952#M169220</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-09-23T14:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL join?  Maybe inner?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/590954#M169222</link>
      <description>&lt;P&gt;With 100 obs, simply create an informat (since you need to create a numeric value) and apply it during any step where you process the large dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 14:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/590954#M169222</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-23T14:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL join?  Maybe inner?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/590956#M169223</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thumb rule:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Check for duplicate ID occurances in both datasets&lt;/P&gt;
&lt;P&gt;2. If one has many ID's your larger one, and the other has only unique occurances of ID, it's a one to many join.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So as long as it's one to one or one to many, you can play with merge/join/hash etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you determine, both having multiple ID occurrences, then post your sample data and your expected output. Somebody can advice you at best!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 15:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/590956#M169223</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-23T15:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL join?  Maybe inner?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/591044#M169260</link>
      <description>&lt;P&gt;Do you need to create a new dataset? You could update the existing dataset with something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
update dataset1 as a
set status = (select status from dataset2 where id=a.id)
where id in (select id from dataset2);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 20:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-join-Maybe-inner/m-p/591044#M169260</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-09-23T20:55:25Z</dc:date>
    </item>
  </channel>
</rss>

