<?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 inline view alternative in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248311#M46641</link>
    <description>&lt;P&gt;How is this code different than your original question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did the code I provided not work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Feb 2016 16:24:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-02-05T16:24:20Z</dc:date>
    <item>
      <title>Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248260#M46612</link>
      <description>&lt;P&gt;I wonder if this can code have inline view alternative ie. nested query in FROM clause?&lt;/P&gt;&lt;PRE&gt;PROC SQL;
  CREATE TABLE T1 AS 
  SELECT *
   FROM T2 
     WHERE ID NOT IN (SELECT ID FROM T3) AND
          AGE IN (11,12,13,15);
 QUIT;	       
RUN;
%PUT &amp;amp;SQLOBS;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 14:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248260#M46612</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-02-05T14:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248266#M46615</link>
      <description>&lt;P&gt;Seems fine to me, whats the problem. &amp;nbsp;Test data/log output etc.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 15:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248266#M46615</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-05T15:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248279#M46621</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9﻿&lt;/a&gt;&amp;nbsp;I want to have all source data from coming FROM clause and use WHERE clause to subset the data after that. If the nested query in WHERE clause can be moved in FROM clause? Like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;
  CREATE TABLE T1 AS 
  SELECT *
   FROM (SELECT........)
     WHERE AGE IN (11,12,13,15);
 QUIT;	       
RUN;
%PUT &amp;amp;SQLOBS;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 15:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248279#M46621</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-02-05T15:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248282#M46623</link>
      <description>&lt;P&gt;Yes it can be moved to the JOIN and conditioning on your WHERE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To figure out your conditions I would suggest bringing in both of the ID's, examing the case and determing what you need to get only the rows you want. &amp;nbsp;Here's a starting point for you:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
where name not in ('Alfred', 'John');
run;

proc sql;
create table want as
select a.*, a.name as ID1, b.name as ID2
from sashelp.class as a
full join class as b 
on a.name=b.name
/*ADD WHERE CLAUSE HERE*/;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 15:42:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248282#M46623</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-05T15:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248285#M46626</link>
      <description>&lt;P&gt;Wrap it the other way round then:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table T1 as
  select *
  from   (select *
            from (select........))
  where AGE in (11,12,13,15);
quit;&lt;/PRE&gt;
&lt;P&gt;Note, you don't need the run; part. &amp;nbsp;If you can provide test data (as a datastep) examples and wht you want the output to look like we can be more accurate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 15:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248285#M46626</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-05T15:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248290#M46629</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;. I thought about that way. Was looking for elegant code. I have really huge and confidential data that's why I did no put it. I should have put some mock data set.&lt;BR /&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE T1 AS&lt;BR /&gt;SELECT *&lt;BR /&gt;FROM (&lt;BR /&gt;SELECT * FROM T2&lt;BR /&gt;WHERE ID NOT IN (SELECT ID FROM T3)&lt;BR /&gt;)&lt;BR /&gt;WHERE&lt;BR /&gt;AGE IN (11,12,13,15);&lt;BR /&gt;QUIT;&lt;BR /&gt;RUN;&lt;BR /&gt;%PUT &amp;amp;SQLOBS;</description>
      <pubDate>Fri, 05 Feb 2016 16:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248290#M46629</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-02-05T16:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248301#M46635</link>
      <description>&lt;P&gt;Not sure what your trying to gain though, it doesn't actually change anything, just a positiiong on the code, won't save you time or processing:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table T1 as
  select  *
  from    T2
  where   ID not in (select ID from t3)
    and   age in (11,12,13,15);
quit;
&lt;/PRE&gt;
&lt;P&gt;The above is exactly the same, and will run the same? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 16:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248301#M46635</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-05T16:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248311#M46641</link>
      <description>&lt;P&gt;How is this code different than your original question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did the code I provided not work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 16:24:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248311#M46641</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-05T16:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248314#M46642</link>
      <description>&lt;P&gt;That makes sense. &amp;nbsp;I &amp;nbsp;also thought inline view could create virtual table and processing could have been faster. &amp;nbsp;Not sure this is correct tough.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 16:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248314#M46642</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-02-05T16:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql inline view alternative</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248315#M46643</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;. The code you provided makes sense. &amp;nbsp;I have not tried your code at production yet. But will give &amp;nbsp;a shot. &amp;nbsp;Thanks !&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 16:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-inline-view-alternative/m-p/248315#M46643</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-02-05T16:30:59Z</dc:date>
    </item>
  </channel>
</rss>

