<?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: Joining dataset from an import with a SAS dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355419#M64184</link>
    <description>&lt;P&gt;Thanks. I will give that a shot&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2017 22:09:20 GMT</pubDate>
    <dc:creator>wheddingsjr</dc:creator>
    <dc:date>2017-05-02T22:09:20Z</dc:date>
    <item>
      <title>Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355406#M64180</link>
      <description>&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have run a query in SAS and have my results in a table called "RESULTS", I also imported a excel sheet into the program labled "CONSULT". I want to get a dataset where the two tables are joined to retrieve certain data. I was told that was possible but when I ran the below query I got the error message that follows the query. Any suggestions would be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table endresult as&lt;BR /&gt;select a.*&lt;BR /&gt;from results as a, Consult as b&lt;BR /&gt;where a.memno = b.memno and a.SProv_Spec = b.SProv_Spec and a.Prov_TAXID = b.Prov_TAXID&lt;BR /&gt;order by a.memno, a.SProv_Spec, a.Prov_TAXID;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;ERROR: File WORK.CONSULT.DATA does not exist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 21:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355406#M64180</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2017-05-02T21:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355412#M64181</link>
      <description>&lt;P&gt;Show the code/log from the import of the Excel file - it looks like it wasn't created properly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 21:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355412#M64181</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-02T21:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355415#M64182</link>
      <description>&lt;P&gt;I just thought of something. As I was getting ready to attach the code/log, I realized I changed the name of the file to "Consults" in both the code and the log it reads:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA WORK._99241_99245_Edited&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That was the original name of the file. Could that be the problem or do you still need to see the log?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 21:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355415#M64182</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2017-05-02T21:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355417#M64183</link>
      <description>&lt;P&gt;Use that data set name instead of Consults and it may well&amp;nbsp;work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 22:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355417#M64183</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-02T22:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355419#M64184</link>
      <description>&lt;P&gt;Thanks. I will give that a shot&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 22:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355419#M64184</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2017-05-02T22:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355420#M64185</link>
      <description>&lt;P&gt;Do I use DATA WORK._99241_99245_Edited or just _99241_99245_Edited&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 22:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355420#M64185</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2017-05-02T22:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355423#M64186</link>
      <description>&lt;P&gt;You need DATA but not the WORK.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 22:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355423#M64186</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-02T22:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355424#M64187</link>
      <description>&lt;P&gt;Like this??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table endresult as&lt;BR /&gt;select a.*&lt;BR /&gt;from results as a, DATA _99241_99245_Edited as b&lt;BR /&gt;where a.memno = b.memno and a.SProv_Spec = b.SProv_Spec and a.Prov_TAXID = b.Prov_TAXID&lt;BR /&gt;order by a.memno, a.SProv_Spec, a.Prov_TAXID;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 22:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355424#M64187</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2017-05-02T22:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Joining dataset from an import with a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355429#M64188</link>
      <description>&lt;P&gt;Fastest way is to try it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If you tried it and it didn't work, you should include your log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you're using a SQL step, you only include the dataset name. I thought you were using a Data step, therefore needed the DATA keyword. Personally, I'll always explicitly define my join type, here you've left it blank which is a CROSS join (cartesian product) but I've changed it to LEFT JOIN and use the ON clause instead of WHERE. The different join types are illustrated below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table endresult as
select a.*
from results as a
left join _99241_99245_Edited as b
on a.memno = b.memno and a.SProv_Spec = b.SProv_Spec and a.Prov_TAXID = b.Prov_TAXID
order by a.memno, a.SProv_Spec, a.Prov_TAXID;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://i.stack.imgur.com/1UKp7.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 22:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Joining-dataset-from-an-import-with-a-SAS-dataset/m-p/355429#M64188</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-02T22:56:08Z</dc:date>
    </item>
  </channel>
</rss>

