<?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: in-line view subquery in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241762#M44817</link>
    <description>Possibly, like I mentioned it's a broad question. I would use a cross join in that case. As a way to replicate the first/last processing is a better example. How would you implement a first/last logic from data step in SQL?&lt;BR /&gt;&lt;BR /&gt;What answer are you looking for? Here's a set of X scenario's to use an In Line Query? Part of this is experience, which people can share, and part of this is preference. I hate in line queries and prefer to generatetemp tables for clarity. Efficiency isn't usually a huge part of my programming tasks. &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 04 Jan 2016 23:06:18 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-01-04T23:06:18Z</dc:date>
    <item>
      <title>in-line view subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241754#M44814</link>
      <description>&lt;P&gt;I have included here an in-line view examle &amp;nbsp;in Proc &amp;nbsp;Sql (left join of three tables). &amp;nbsp;What are the most common uses of it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test1;
input id1 x;
cards;
1 3
2 5
3 6
;
run;

data test2;
input id2 y;
cards;
1 7
2 9
4 4
;
run;

data test3;
input id3 z;
cards;
1 8
3 9
4 2
;
run;


proc sql;
  select a.x,b.y,c.z
        from (select a.x,b.y 
                   from test1 a
				       left join test2 b
					     on a.id1=b.id2)
		left join test3 c
		  on a.id1=c.id3;
  quit;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jan 2016 22:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241754#M44814</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-01-04T22:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: in-line view subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241757#M44815</link>
      <description>&lt;P&gt;That's a fairly broad question...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll shoot back, your in line query doesn't add value. You can accomplish the same thing directly via:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want2 as
  select a.x,b.y,c.z
from test1 a
left join test2 b
on a.id1=b.id2
left join test3 c
 on a.id1=c.id3;
  quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Typically, I think In line queries are used when you want to add in some data that was summarized already so you'll see a join with something like date=min(date) to get the first record of an event . It's also when you need to look up information for a specific field in a table but need to summarize that information first somehow, so you'll see select sum(a.x) as sum_x in the subquery. &amp;nbsp;As always, there are other ways to accomplish these tasks beside inline queries.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 22:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241757#M44815</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-04T22:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: in-line view subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241760#M44816</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;&amp;nbsp;So you mean like this code,&amp;nbsp;that will join a summary data to every observation of some other data set ?&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if _N_=1 then &lt;BR /&gt;          set some_summary_data ;&lt;BR /&gt;          set some_other_data_set;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jan 2016 22:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241760#M44816</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-01-04T22:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: in-line view subquery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241762#M44817</link>
      <description>Possibly, like I mentioned it's a broad question. I would use a cross join in that case. As a way to replicate the first/last processing is a better example. How would you implement a first/last logic from data step in SQL?&lt;BR /&gt;&lt;BR /&gt;What answer are you looking for? Here's a set of X scenario's to use an In Line Query? Part of this is experience, which people can share, and part of this is preference. I hate in line queries and prefer to generatetemp tables for clarity. Efficiency isn't usually a huge part of my programming tasks. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Jan 2016 23:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-line-view-subquery/m-p/241762#M44817</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-04T23:06:18Z</dc:date>
    </item>
  </channel>
</rss>

