<?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: Create 2 tables using Proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104093#M21738</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately I think it is not possible within the same SQL statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table example as select from .......;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could do it in two SQL statements but that means passing through your data twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of the advantages of the DATA step is the ability to create multiple tables while processing your input data (datasets One and Two) only once. Why not stick with your sample code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jul 2012 02:19:55 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2012-07-11T02:19:55Z</dc:date>
    <item>
      <title>Create 2 tables using Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104092#M21737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use Proc Sql to create 2 tables at a time. Below is my sample code in data step. Any suggestions would help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Match NoMatch;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Merge One (in=a) Two (in=b);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; By id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if a*b then output Match;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if a=1 and b ne 1 then output NoMatch;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else delete;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2012 20:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104092#M21737</guid>
      <dc:creator>rsva</dc:creator>
      <dc:date>2012-07-10T20:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create 2 tables using Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104093#M21738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately I think it is not possible within the same SQL statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table example as select from .......;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could do it in two SQL statements but that means passing through your data twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of the advantages of the DATA step is the ability to create multiple tables while processing your input data (datasets One and Two) only once. Why not stick with your sample code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2012 02:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104093#M21738</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2012-07-11T02:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create 2 tables using Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104094#M21739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can confirm SASKiwi's comment. I researched this for a client once, and you can't create two tables from one SQL select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, your DATA step is the best solution, unless there's another reason for wanting to use SQL?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2012 13:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104094#M21739</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2012-07-11T13:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create 2 tables using Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104095#M21740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks SASKiwi and TomKari. I wanted to see if I can use Proc Sql to avoid sorting and renaming the variables since I have to create quite a few data (Match and NoMatch) and then merge with 2 other data. Just wanted to explore the option. Anyway it's good to know that we do not have an option to do in Proc SQL. BUT it would be nice to have it since I have had to do this on several occasions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aruna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2012 14:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104095#M21740</guid>
      <dc:creator>rsva</dc:creator>
      <dc:date>2012-07-11T14:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create 2 tables using Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104096#M21741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By any chance, does one of your data sets contain just the variable ID?&amp;nbsp; If you are only looking to determine matches/mismatches with a master list of IDs, and not bringing in other variables, there are plenty of other ways to go about it (formats, hashing).&amp;nbsp; And a DATA step will let you process tons of data sets in the same step if that is the case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2012 15:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104096#M21741</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-07-11T15:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create 2 tables using Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104097#M21742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is an "almost" solution which will allow the logic to remain in SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See &lt;A href="http://www.sascommunity.org/wiki/CREATE_statement_(SQL)_can_generate_only_one_output" title="http://www.sascommunity.org/wiki/CREATE_statement_(SQL)_can_generate_only_one_output"&gt;http://www.sascommunity.org/wiki/CREATE_statement_(SQL)_can_generate_only_one_output&lt;/A&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;rsva wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I am trying to use Proc Sql to create 2 tables at a time. Below is my sample code in data step. Any suggestions would help.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Data Match NoMatch;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Merge One (in=a) Two (in=b);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; By id;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if a*b then output Match;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if a=1 and b ne 1 then output NoMatch;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else delete;&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 01:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104097#M21742</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2012-07-12T01:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create 2 tables using Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104098#M21743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One important point; although you don't add code in a SQL Join to sort the data, in any non-trivial application the data wil be sorted behind the scenes to enable the merge. I've seen cases where people think they save resources by eliminating one or more sorts, and this is absolutely not the case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 14:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-2-tables-using-Proc-sql/m-p/104098#M21743</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2012-07-12T14:28:40Z</dc:date>
    </item>
  </channel>
</rss>

