<?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 Warning in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420924#M67931</link>
    <description>&lt;P&gt;Thanks, it works.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2017 18:14:05 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2017-12-13T18:14:05Z</dc:date>
    <item>
      <title>PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420789#M67912</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran the codes below.&amp;nbsp; I found some warning and note messages shown up.&amp;nbsp; In addition, the PROC SQL is going forever, it never stopped.&amp;nbsp;&amp;nbsp; Please advice how to fix it.&amp;nbsp; Thank you!&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; MasterP &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;select&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;a.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;p,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;b.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;p,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;c.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;p&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;from&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;class &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; a,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;component &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; b,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;product &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; c&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;a.&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;p&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; eq &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; or &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;b.&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;p&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; eq &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; or &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;c.&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;p&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; eq &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: The execution of this query involves performing one or more Cartesian product joins that&lt;/P&gt;
&lt;P&gt;can not be optimized.&lt;/P&gt;
&lt;P&gt;WARNING: Variable P already exists on file WORK.MASTERP.&lt;/P&gt;
&lt;P&gt;WARNING: Variable P already exists on file WORK.MASTERP.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420789#M67912</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-12-13T14:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420793#M67913</link>
      <description>&lt;P&gt;1 - Show a sample of your data for us to debug your program. We can't see your data, so we can't see your problem&lt;/P&gt;
&lt;P&gt;2 - Define aliases for commonly named variables (in this case p) like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;select&lt;BR /&gt; a.p as a_p,&lt;BR /&gt; b.p as b_p,&lt;BR /&gt; c.p as c_p&lt;BR /&gt;from&lt;/PRE&gt;
&lt;P&gt;3 - You are most likely missing some condition in your where statement, since as of not you are creating at least one&amp;nbsp;&lt;SPAN&gt;Cartesian Product, which is rarely desired.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420793#M67913</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-13T14:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420795#M67914</link>
      <description>&lt;P&gt;If you're going to use SQL, you will need to learn about what a Cartesian product is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, let's say that each source (A, B, and C) contains 1,000 observations with a missing value for P.&amp;nbsp; Your request is asking for a table with a billion observations in it.&amp;nbsp; No wonder it is taking a while.&amp;nbsp; You would be much better served to use a DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data missings;&lt;/P&gt;
&lt;P&gt;set class&amp;nbsp;component product;&lt;/P&gt;
&lt;P&gt;where p=.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420795#M67914</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-13T14:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420797#M67915</link>
      <description>&lt;P&gt;Hi Astounding:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did have a data step to do this inquire.&amp;nbsp; I would like to use Proc SQL so that I could confirm the one I created was right and save the merge step.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420797#M67915</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-12-13T14:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420798#M67916</link>
      <description>&lt;P&gt;Each table contains at least 3000 observation.&amp;nbsp;&amp;nbsp; I can't show it here.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:25:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420798#M67916</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-12-13T14:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420799#M67917</link>
      <description>&lt;P&gt;What does your data look like?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420799#M67917</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-13T14:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420801#M67918</link>
      <description>&lt;P&gt;Not asking you to post 9000 lines of data, just a simple outline of the structure of you data, preferibly in the form of data steps with a few observations, so it is easy to work with &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420801#M67918</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-13T14:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420802#M67919</link>
      <description>&lt;P&gt;In that case, take a look at UNION.&amp;nbsp; It also has its tricky aspects, but is probably the right tool for the job for QC/comparison purposes.&amp;nbsp; It's just barely beyond my SQL knowledge, but I'm sure somebody can post a reasonably short example.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420802#M67919</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-13T14:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420804#M67920</link>
      <description>&lt;P&gt;First of all, you need to give the variables new names if you want to see them in the output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select
  a.p as p_a,
  b.p as p_b,
  c.p as p_c&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That would take care of the NOTEs&lt;/P&gt;
&lt;P&gt;What happens then is: The first obs in class where p is missing is joined with ALL obs (regardless of values) from the other two datasets. The same for the next obs that has p missing, and so on. The same also happens for all observations with missing p in the other two datasets, so you get a &lt;EM&gt;real lot&lt;/EM&gt; of output observations. Bottom line: be careful with your where conditions, especially when no join on a key variable is defined.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420804#M67920</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-13T14:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420806#M67921</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; My plan was looking for the missing value in P columns of A, B, and&amp;nbsp;C tables.&amp;nbsp;&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420806#M67921</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-12-13T14:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420807#M67922</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Each table contains at least 3000 observation.&amp;nbsp;&amp;nbsp; I can't show it here.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then you could easily end up with 27.000.000.000 observations in your resulting dataset. Just run your SQL on subsets with 100 observations each, and you'll see what happens.&lt;/P&gt;
&lt;P&gt;If you just post those subsets as datasteps here, and an example for the expected result, we can easily show you the code that can do it.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420807#M67922</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-13T14:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420809#M67923</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yes.&amp;nbsp; My plan was looking for the missing value in P columns of A, B, and&amp;nbsp;C tables.&amp;nbsp;&amp;nbsp; Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then just do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set
  class
  component
  product
;
where p = .;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will end up with quite a wide structure, but it can't be more than nobs(class) + nobs(component) + nobs(product) observations. Instead of nobs(class) * nobs(component) * nobs(product)!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420809#M67923</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-13T14:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420810#M67924</link>
      <description>&lt;P&gt;Hi KurtBremser:&lt;/P&gt;
&lt;P&gt;The way you are doing will end up create three new columns p_a, p_b and p_c.&amp;nbsp; What about if I would like to generate all of them in single column?&amp;nbsp; Also, I have data step to do this.&amp;nbsp; I just want to try the PROC SQL way to confirm my previous work.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420810#M67924</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-12-13T14:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420813#M67925</link>
      <description>&lt;P&gt;It would be &lt;EM&gt;mighty&lt;/EM&gt; helpful if you posted that data step code.&lt;/P&gt;
&lt;P&gt;This:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table MasterP as
select p from class
where p = .
union all
select p from component
where p = .
union all
select p from product
where p = .
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will give you all the missing values stacked on top of each other. The number of observations will be the sum (not the product) of the missing's in the datasets.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 14:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420813#M67925</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-13T14:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420924#M67931</link>
      <description>&lt;P&gt;Thanks, it works.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 18:14:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Warning/m-p/420924#M67931</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-12-13T18:14:05Z</dc:date>
    </item>
  </channel>
</rss>

