<?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: Using new created fields in PROC Sql - Joins in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40073#M8108</link>
    <description>Hi.&lt;BR /&gt;
I agree with Patrick.You need two sql statments.&lt;BR /&gt;
The first one to create your needed dataset by calculated variable.&lt;BR /&gt;
The second one to left jion.</description>
    <pubDate>Fri, 25 Jun 2010 04:27:13 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2010-06-25T04:27:13Z</dc:date>
    <item>
      <title>Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40070#M8105</link>
      <description>Hi everybody,&lt;BR /&gt;
&lt;BR /&gt;
I'm actually trying to create a new field in the SELECT-Statement by using the CASE-Function and referring to this field in the join-condition (e.g. join a left join b &lt;BR /&gt;
on a.x = calculated &lt;I&gt;new_field&lt;/I&gt;). &lt;BR /&gt;
But somehow it doesn't work, maybe it's because I'm restricted to using the "calculated"-fields only in SELECT- and WHERE-clauses. &lt;BR /&gt;
Does anybody have an idea how to solve this problem? &lt;BR /&gt;
&lt;BR /&gt;
Kind Regards,&lt;BR /&gt;
Chris_</description>
      <pubDate>Thu, 24 Jun 2010 09:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40070#M8105</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-24T09:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40071#M8106</link>
      <description>What I normally do in such cases is to first create a view and then join the view with the second table.&lt;BR /&gt;
&lt;BR /&gt;
SQL would sure also allow other approaches - but this approach is easy to read for me.&lt;BR /&gt;
&lt;BR /&gt;
Just to give an example:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create view V_TblA as&lt;BR /&gt;
    select substr(a,3) as key   &lt;HERE could="" be="" your="" case=""&gt;&lt;BR /&gt;
      from TblA&lt;BR /&gt;
  ;&lt;BR /&gt;
  select r.*&lt;BR /&gt;
    from V_TblA as l left join TblB as r&lt;BR /&gt;
      on l.key=r.key&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;/HERE&gt;</description>
      <pubDate>Thu, 24 Jun 2010 12:17:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40071#M8106</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-06-24T12:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40072#M8107</link>
      <description>example of sql will help figure out what is issue</description>
      <pubDate>Thu, 24 Jun 2010 16:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40072#M8107</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-24T16:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40073#M8108</link>
      <description>Hi.&lt;BR /&gt;
I agree with Patrick.You need two sql statments.&lt;BR /&gt;
The first one to create your needed dataset by calculated variable.&lt;BR /&gt;
The second one to left jion.</description>
      <pubDate>Fri, 25 Jun 2010 04:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40073#M8108</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-06-25T04:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40074#M8109</link>
      <description>sounds like establishing the calculated column in a preliminary view, is the only way with base SAS.&lt;BR /&gt;
It would be interesting to review the combined query after it passes through the optimiser. &lt;BR /&gt;
Would the SASTRACE system option, or the _TREE and _METHOD proc sql options help? &lt;BR /&gt;
Are there other ways to explain the implementation of a query?&lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
      <pubDate>Fri, 25 Jun 2010 08:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40074#M8109</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-06-25T08:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40075#M8110</link>
      <description>Hi. Peter&lt;BR /&gt;
I think you are more excellent than me, have more knowledge about sas than me .&lt;BR /&gt;
So I have no idea about it. Also I have a little confusion with implementation of a query.</description>
      <pubDate>Fri, 25 Jun 2010 10:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40075#M8110</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-06-25T10:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40076#M8111</link>
      <description>a useful paper which started me learning how sql works is given at &lt;A href="http://support.sas.com/techsup/technote/ts553.html" target="_blank"&gt;http://support.sas.com/techsup/technote/ts553.html&lt;/A&gt;  "TS-553 SQL Joins -- The Long and The Short of It"&lt;BR /&gt;
It's a really good paper, but if I'm still asking questions, I guess I'm still learning &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Fri, 25 Jun 2010 13:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40076#M8111</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-06-25T13:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using new created fields in PROC Sql - Joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40077#M8112</link>
      <description>Thx. Peter.&lt;BR /&gt;
I will take a look at it.&lt;BR /&gt;
Actually I am a beginner of SAS , so there are so many things to learned.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Sat, 26 Jun 2010 07:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-new-created-fields-in-PROC-Sql-Joins/m-p/40077#M8112</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-06-26T07:25:40Z</dc:date>
    </item>
  </channel>
</rss>

