<?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 left join error - column could not be found in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332939#M62804</link>
    <description>Thanks getting closer. The challenge I have that work.parameterestimatestrans may contain NumSomeColumn. I only want to set NumSomeColumn to 'null'/. if work.parameterestimatestrans does not exist.</description>
    <pubDate>Wed, 15 Feb 2017 10:40:31 GMT</pubDate>
    <dc:creator>csetzkorn</dc:creator>
    <dc:date>2017-02-15T10:40:31Z</dc:date>
    <item>
      <title>proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332809#M62795</link>
      <description>&lt;P&gt;I am getting this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Column SomeColumn could not be found in the table/view identified with the correlation name TRANS.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
CREATE TABLE WORK.Test AS
select
Trans.SomeColumn 
from WORK.Joiner AS J
left outer join work.parameterestimatestrans AS Trans
ON J._NAME_ = Trans._NAME_;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I know that SomeColumn is not in the table aliased Trans. However, a left out join should simply return a null (i.e. . in SAS). So I am a bit confused about the non sql sas behaviour. Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 21:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332809#M62795</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-02-14T21:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332811#M62796</link>
      <description>&lt;P&gt;The error is exactly what should happen. You explicitly named a column in the select that does not exist, so your select statement is useless.&lt;/P&gt;
&lt;P&gt;SQL does not automatically create variables with missing values, as the data step does.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 22:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332811#M62796</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-14T22:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332815#M62797</link>
      <description>Would you mind creating the datastep equivalent please?</description>
      <pubDate>Tue, 14 Feb 2017 22:08:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332815#M62797</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-02-14T22:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332829#M62798</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99946"&gt;@csetzkorn&lt;/a&gt; wrote:&lt;BR /&gt;Would you mind creating the datastep equivalent please?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It might help if you describe what the output should be. From the code posted it only appears that you want a data set with single variable and all values missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 23:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332829#M62798</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-14T23:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332830#M62799</link>
      <description>There is no exact equivalent between SQL and the data step. Isn't it easier to fix the existing query? &lt;BR /&gt;If you want to create a column with missing values specify it as a constant in the select clause.</description>
      <pubDate>Tue, 14 Feb 2017 23:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332830#M62799</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-02-14T23:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332837#M62800</link>
      <description>&lt;P&gt;Here, I fixed it for you, with a numeric and character missing.&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 WORK.Test AS
select
" " as SomeColumn,
. as NumSomeColumn
from WORK.Joiner AS J
left outer join work.parameterestimatestrans AS Trans
ON J._NAME_ = Trans._NAME_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Feb 2017 23:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332837#M62800</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-14T23:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332939#M62804</link>
      <description>Thanks getting closer. The challenge I have that work.parameterestimatestrans may contain NumSomeColumn. I only want to set NumSomeColumn to 'null'/. if work.parameterestimatestrans does not exist.</description>
      <pubDate>Wed, 15 Feb 2017 10:40:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332939#M62804</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-02-15T10:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332943#M62805</link>
      <description>&lt;P&gt;I found a solution to my problem. Using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.parameterestimatestrans;
    set work.parameterestimatestrans;
	NumSomeColumn = coalesce(NumSomeColumn,.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Will impute the variable should it be missing and the left join picks this up.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 10:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332943#M62805</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-02-15T10:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332944#M62806</link>
      <description>&lt;P&gt;What do you mean by&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99946"&gt;@csetzkorn&lt;/a&gt; wrote:&lt;BR /&gt;&amp;nbsp;if work.parameterestimatestrans does not exist.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;- the dataset does not exist&lt;/P&gt;
&lt;P&gt;- or the dataset exists, but there is no matching record in it&lt;/P&gt;
&lt;P&gt;- or the column does not exist in the dataset&lt;/P&gt;
&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 11:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332944#M62806</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-15T11:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332973#M62808</link>
      <description>I meant if NumSomeColumn does not exist in work.parameterestimatestrans</description>
      <pubDate>Wed, 15 Feb 2017 12:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332973#M62808</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-02-15T12:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332978#M62809</link>
      <description>&lt;P&gt;If it doesn't exist the COALESCE doesn't do anything.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It assigns a missing value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 12:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332978#M62809</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-15T12:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join error - column could not be found</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332985#M62810</link>
      <description>&lt;P&gt;Since the OP has finally stated his/her true intentions, I can say that the data step with coalesce() is the correct solution.&lt;/P&gt;
&lt;P&gt;The OP wants to reach a state where the variable will be present, no matter what is in the original dataset.&lt;/P&gt;
&lt;P&gt;If the variable is not there, it will be created as missing, if it is there, the values will be preserved.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 13:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-error-column-could-not-be-found/m-p/332985#M62810</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-15T13:10:11Z</dc:date>
    </item>
  </channel>
</rss>

