<?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: PROC SQL CREATE TABLE in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574849#M75427</link>
    <description>Can you consider appending them instead via append and using format or something else to determine var3?</description>
    <pubDate>Fri, 19 Jul 2019 01:17:12 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-07-19T01:17:12Z</dc:date>
    <item>
      <title>PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574826#M75420</link>
      <description>I am running the following approxmited code:&lt;BR /&gt;&lt;BR /&gt;proc sql; create table folder1.table1 as&lt;BR /&gt;select&lt;BR /&gt;col1,&lt;BR /&gt;col2,&lt;BR /&gt;case&lt;BR /&gt;when col2 in ( '1', '2') then 'text'&lt;BR /&gt;end as col3&lt;BR /&gt;from&lt;BR /&gt;table2&lt;BR /&gt;union all&lt;BR /&gt;select&lt;BR /&gt;col1,&lt;BR /&gt;col2,&lt;BR /&gt;case&lt;BR /&gt;when col2 in ( '1', '2') then 'text'&lt;BR /&gt;end as col3&lt;BR /&gt;from&lt;BR /&gt;table3&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;But when table1 appears in folder1 and I try open it through SAS EG by double clicking on the file in the library lost I get the following error:&lt;BR /&gt;&lt;BR /&gt;table1 does not exist. You will need to refresh the task that&lt;BR /&gt;created it before it can be opened.&lt;BR /&gt;&lt;BR /&gt;When I set inobs and outobs to ten the table opens just fine.&lt;BR /&gt;&lt;BR /&gt;Does anyone know what might be going on?&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Thu, 18 Jul 2019 23:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574826#M75420</guid>
      <dc:creator>cmcooper11</dc:creator>
      <dc:date>2019-07-18T23:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574831#M75421</link>
      <description>&lt;P&gt;What does the log show? Can you post that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if you try a proc contents on the data set, right after this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=folder1.table1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/282065"&gt;@cmcooper11&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I am running the following approxmited code:&lt;BR /&gt;&lt;BR /&gt;proc sql; create table folder1.table1 as&lt;BR /&gt;select&lt;BR /&gt;col1,&lt;BR /&gt;col2,&lt;BR /&gt;case&lt;BR /&gt;when col2 in ( '1', '2') then 'text'&lt;BR /&gt;end as col3&lt;BR /&gt;from&lt;BR /&gt;table2&lt;BR /&gt;union all&lt;BR /&gt;select&lt;BR /&gt;col1,&lt;BR /&gt;col2,&lt;BR /&gt;case&lt;BR /&gt;when col2 in ( '1', '2') then 'text'&lt;BR /&gt;end as col3&lt;BR /&gt;from&lt;BR /&gt;table3&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;But when table1 appears in folder1 and I try open it through SAS EG by double clicking on the file in the library lost I get the following error:&lt;BR /&gt;&lt;BR /&gt;table1 does not exist. You will need to refresh the task that&lt;BR /&gt;created it before it can be opened.&lt;BR /&gt;&lt;BR /&gt;When I set inobs and outobs to ten the table opens just fine.&lt;BR /&gt;&lt;BR /&gt;Does anyone know what might be going on?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 00:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574831#M75421</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-19T00:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574837#M75422</link>
      <description>&lt;P&gt;I won't have the computer that is running the query until tomorrow morning, but there wasn't anything that stood out to me in the logs. There was some warning/note about being unable to use compression and a warning that an "&amp;amp;" in the case statement&amp;nbsp; then values. I have run similar queries without issues before and those warnings/notes were in those logs too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will give the proc contents command a chance tomorrow and let you know. I did try:&lt;/P&gt;&lt;PRE&gt;proc sql; select * from folder1.table1; quit;&lt;/PRE&gt;&lt;P&gt;but the SAS EG instance locked up both times that I tried it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could it be that I just tried to interact with the file before it was done being written to? I believe that Table2 and Table3 have somewhere around 100 million rows.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 00:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574837#M75422</guid>
      <dc:creator>cmcooper11</dc:creator>
      <dc:date>2019-07-19T00:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574838#M75423</link>
      <description>You're trying to view results that may be 100 million rows? Yeah, just opening that table may make EG crash. Instead print out small subsets.</description>
      <pubDate>Fri, 19 Jul 2019 00:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574838#M75423</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-19T00:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574841#M75424</link>
      <description>&lt;P&gt;I don't think that has been an issue for me before. How do you recommend I view a subset of the table? I'm pretty new to SAS so I apologize if that is a trivial question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main reason for my concern is that it seem like my code gets hung during that particular proc sql statement and that the inaccessible table is a sign of a deeper issue that I haven't identified yet.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:06:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574841#M75424</guid>
      <dc:creator>cmcooper11</dc:creator>
      <dc:date>2019-07-19T01:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574844#M75425</link>
      <description>Well, if it was still running the progress bar would show that. Are you keeping on eye on that? It's usually at the bottom of the IDE. &lt;BR /&gt;&lt;BR /&gt;For viewing a subset you can either create a small subset and view it or use PROC PRINT. &lt;BR /&gt;&lt;BR /&gt;data temp;&lt;BR /&gt;set bigTable (obs=100);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc print data=BigTable (obs=100);&lt;BR /&gt;run;</description>
      <pubDate>Fri, 19 Jul 2019 01:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574844#M75425</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-19T01:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574848#M75426</link>
      <description>&lt;P&gt;I did see that is was still running according to the progress bar at the bottom. In the past, I have had the progress bar change from "running program blah on..." to something like "running (ready)", but code had not made any apparent progress in two days. Restarting the code showed that it only took one day to run. Given all of this I have been a little suspicious of the progress bar.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will give the proc contents command and printing a subset a chance tomorrow and let you know.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your help with this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574848#M75426</guid>
      <dc:creator>cmcooper11</dc:creator>
      <dc:date>2019-07-19T01:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574849#M75427</link>
      <description>Can you consider appending them instead via append and using format or something else to determine var3?</description>
      <pubDate>Fri, 19 Jul 2019 01:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574849#M75427</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-19T01:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574850#M75428</link>
      <description>&lt;P&gt;The majority of my programming in SAS has been using PROC SQL. Could you give me an example of what you mean? Would your example replace the UNION and CASE in first example?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574850#M75428</guid>
      <dc:creator>cmcooper11</dc:creator>
      <dc:date>2019-07-19T01:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574852#M75429</link>
      <description>&lt;P&gt;CASE is the part that can't be reproduced within an append.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this would add the data to table2 instead of create a new output table. For the var3 you could choose to either&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc append base=table2 (keep=(var1 var2)) data=table3(Keep=var1 var2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;When appending like this, SAS copies the data over in blocks, not line by line because it isn't processing anything. You can add the var3 in later or change var2 to show that if needed or there are other options depending on what you need to do next.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/282065"&gt;@cmcooper11&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The majority of my programming in SAS has been using PROC SQL. Could you give me an example of what you mean? Would your example replace the UNION and CASE in first example?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574852#M75429</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-19T01:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574853#M75430</link>
      <description>&lt;P&gt;So I imagine that using append will be quite a bit faster then?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If table2 is a file, is that file permanently modified?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The case statement could have been replace with a join by putting the case data into a data set, which I would be comfortable doing with my current skills. Is the a PROC command similar to either a SQL case or join?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:35:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574853#M75430</guid>
      <dc:creator>cmcooper11</dc:creator>
      <dc:date>2019-07-19T01:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574854#M75431</link>
      <description>PROCs are different to SQL and optimized for smaller tasks that are done quite often. APPEND will only union the two files, you'll need a second step to create the new variable but I do think a format would work for whatever you're doing. &lt;BR /&gt;&lt;BR /&gt;You can definitely get away with just using SQL in SAS but it's not an efficient method by any means.</description>
      <pubDate>Fri, 19 Jul 2019 01:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574854#M75431</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-19T01:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL CREATE TABLE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574855#M75432</link>
      <description>&lt;P&gt;This has been very insightful. I will apply your suggestions and update tomorrow.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-CREATE-TABLE/m-p/574855#M75432</guid>
      <dc:creator>cmcooper11</dc:creator>
      <dc:date>2019-07-19T01:48:32Z</dc:date>
    </item>
  </channel>
</rss>

