<?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: Creating proc sql ON clause in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642452#M191655</link>
    <description>&lt;P&gt;Once again, properly formatted code will answer most of the questions for you.&lt;/P&gt;
&lt;P&gt;For example, isn't this a lot clearer?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table dadkid4  as
  select  *
        , (dads.famid = faminc.famid)        as indic 
        , (dads.famid ~= .)                  as dadind
        , (faminc.famid ~= .)                as famind
        , coalesce(dads.famid, faminc.famid) as fid
  from dads 
         full join 
       faminc 
         on dads.famid=faminc.famid;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is no excuse for not formatting code.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Apr 2020 21:54:47 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-04-24T21:54:47Z</dc:date>
    <item>
      <title>Creating proc sql ON clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642090#M191507</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
  create table dadkid4  as
  select  *, (dads.famid=faminc.famid) as indic, 
             (dads.famid ~=.) as dadind,
             (faminc.famid ~=.) as famind,
             coalesce(dads.famid, faminc.famid) as fid
  from dads full join faminc on dads.famid=faminc.famid;
quit;

proc print data=dadkid4;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;can anyone briefly explain the above code?&lt;/P&gt;&lt;P&gt;how we use ~=. in SELECT ?&lt;/P&gt;&lt;P&gt;when do we use ON clause in FROM ?&lt;/P&gt;&lt;P&gt;diff bt ON and WHERE ?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 21:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642090#M191507</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2020-04-22T21:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating proc sql ON clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642104#M191517</link>
      <description>&lt;P&gt;~=&amp;nbsp; is "not equal", you could use the NE as well. The comparisons are creating 1/0 coded values when the indicated variable is missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ON is used with JOIN. It is how the records from sets are compared to match the desired records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WHERE is applied after records are joined. You can often get the same result as an ON but it may be much more inefficient to test after the records are combined.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 21:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642104#M191517</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-22T21:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating proc sql ON clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642406#M191630</link>
      <description>&lt;P&gt;Thank you for the explanation. Still not very clear about ON clause. I understood it. But i would like to look or practice more examples. Can you share any ? Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 21:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642406#M191630</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2020-04-23T21:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating proc sql ON clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642410#M191632</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the explanation. Still not very clear about ON clause. I understood it. But i would like to look or practice more examples. Can you share any ? Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Search the SAS documentation for "JOIN". Most of the responses will SQL with ON somewhere in the mix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically think "match records on these variables".&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 21:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642410#M191632</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-23T21:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating proc sql ON clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642452#M191655</link>
      <description>&lt;P&gt;Once again, properly formatted code will answer most of the questions for you.&lt;/P&gt;
&lt;P&gt;For example, isn't this a lot clearer?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table dadkid4  as
  select  *
        , (dads.famid = faminc.famid)        as indic 
        , (dads.famid ~= .)                  as dadind
        , (faminc.famid ~= .)                as famind
        , coalesce(dads.famid, faminc.famid) as fid
  from dads 
         full join 
       faminc 
         on dads.famid=faminc.famid;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is no excuse for not formatting code.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 21:54:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642452#M191655</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-24T21:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating proc sql ON clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642787#M191806</link>
      <description>&lt;P&gt;Using functions with meaningful names and comments for the not so obvious stuff also helps...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
  create table dadkid4 as
  select  *
        , dads.famid = faminc.famid          as indic  /* data is from both tables */
        , not missing(dads.famid)            as dadind /* has data from table dads */
        , not missing(faminc.famid)          as famind /* has data from table faminc */
        , coalesce(dads.famid, faminc.famid) as fid
  from dads 
         full join 
       faminc 
         on dads.famid=faminc.famid;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 20:54:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-proc-sql-ON-clause/m-p/642787#M191806</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-04-24T20:54:40Z</dc:date>
    </item>
  </channel>
</rss>

