<?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: Auto Remerge when FROM Table vs FROM (Inline view) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/529125#M144516</link>
    <description>&lt;P&gt;Thank you Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;for raising this issue.&amp;nbsp; I suggest you bring it to tech support's attention, and see what they say.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It feels related to this note, but I don't think it quite fits within the criteria listed.&amp;nbsp; &lt;A href="http://support.sas.com/kb/60/119.html" target="_blank"&gt;http://support.sas.com/kb/60/119.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a simple example, where I would expect the in-line view to trigger remerge, but it does not:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input id ;
  cards ;
1
2
3
3
4
5
;

proc sql ;
  select id,j,count(*) 
  from (select id, ranuni(0) as j from have)
  group by id
  ;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The general rule for when will (should) PROC SQL remerge is:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;This note is generated when a column, listed on the select clause,
is not being used in a summary function and the column is not listed on
the GROUP BY clause.  If the column selected is not used in a summary
function, adding it to a GROUP BY clause prevents the note.&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/techsup/notes/v8/4/308.html" target="_blank"&gt;http://support.sas.com/techsup/notes/v8/4/308.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Feels like a bug to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jan 2019 17:03:43 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2019-01-22T17:03:43Z</dc:date>
    <item>
      <title>PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528111#M144093</link>
      <description>&lt;P&gt;PROC SQL: &lt;STRONG&gt;Auto Remerge when "FROM Table vs FROM (Inline view)"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Objective: Lazy me wants to use proc sql remerge as opposed to sort and DOW// proc summarycount and merge back&lt;/P&gt;
&lt;P&gt;Here is the testdata I took from another thread used by draycut and Ksharp to experiment for my case:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data testdata(drop=i j);
   array vars var1-var3;
   do i=1 to 100;
      do j=1 to dim(vars);
         vars[j]=rand('integer', 1, 10);
      end;
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The expected--&amp;gt;&lt;/P&gt;
&lt;P&gt;Get the count of each by group&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
Create table the_expected as
select *, count(*) as c
from testdata
group by var1,var2,var3
order by var1,var2,var3;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Yeah right, so traditional and merge back with the original to get accomplish the objective.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;Intent:&lt;/STRONG&gt; &lt;/EM&gt;&lt;/U&gt;Take advantage of auto emerge and why bother coding the second pass:&lt;/P&gt;
&lt;P&gt;But since there is no open scope for autoremerge for the reason var1,var2 and var3 are the only variables in testdata that also forms the group by combination, a way out to force remerge would be is by having temp variable in select clause and then drop using dataset option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cool as it seems, I thought, let me try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
Create table the_expected(drop=j) as
select *,0 as j, count(*) as c/*purpose of j is to force remerge*/
from testdata
group by var1,var2,var3
order by var1,var2,var3;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, my understanding was obviously&amp;nbsp; incorrect. The precedence is select columns and group by and vice versa seem to go hither and wither. This also makes sense to why users many a times prefer datastep sequential processing if not direct access with point= or whatever that gives greater control.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, Either way, I still need the temp var to force remerge , so how about an &lt;STRONG&gt;inline view&lt;/STRONG&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
Create table inline_view_attempt(drop=j) as
select *,count(*) as c
from (select *,0 as j from testdata)/*purpose of j is to force remerge*/
group by var1,var2,var3
order by var1,var2,var3;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;hmm, idea seems reasonable, but &lt;STRONG&gt;unfavorable&lt;/STRONG&gt; result yet again&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, now what if I had the temp variable created in another query and attempt to &lt;STRONG&gt;read a table&lt;/STRONG&gt; rather than a inline view--&amp;gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
/*temp to hold the extra var j to force remerge*/
create table temp as
select *,0 as j from testdata;/*purpose of j is to force remerge*/

/*query the temp table that has the temp var j */
Create table From_temp_table_attmpt(drop=j) as
select *,count(*) as c
from temp
group by var1,var2,var3
order by var1,var2,var3;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This works fine but completely &lt;STRONG&gt;defeats&lt;/STRONG&gt; the intent and objective.&lt;/P&gt;
&lt;P&gt;Can somebody help me understand the nitty gritty of this behavior?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS&lt;/P&gt;
&lt;P&gt;Above all, the *, remerge et al in general are some features I love about proc sql and I believe I have been using proc sql quite effectively and if can &amp;nbsp;get the understanding to have my mind and fingers to have control over it, all the more the better. Thank you!&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;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&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>Thu, 17 Jan 2019 18:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528111#M144093</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-17T18:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528131#M144096</link>
      <description>&lt;P&gt;You need another variable, otherwise there is nothing to "remerge".&lt;/P&gt;
&lt;P&gt;So if your source table has an extra variable then it will remerge so that it can keep the values of that variable. If you drop that variable there is nothing to remerge with.&lt;/P&gt;
&lt;PRE&gt;134   proc sql;
135   create table the_expected as
136     select *, count(*) as c
137     from testdata
138     group by var1,var2,var3
139     order by var1,var2,var3
140   ;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.THE_EXPECTED created, with 100 rows and 5 columns.

141   create table want as
142     select *, count(*) as c
143     from testdata(drop=n)
144     group by var1,var2,var3
145     order by var1,var2,var3
146   ;
NOTE: Table WORK.WANT created, with 96 rows and 4 columns.

147   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds


&lt;/PRE&gt;
&lt;P&gt;If you keep the count you can always expand it later.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;148
149   data want2;
150     set want ;
151     do n=1 to c;
152       output;
153     end;
154   run;

NOTE: There were 96 observations read from the data set WORK.WANT.
NOTE: The data set WORK.WANT2 has 100 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;Or better just use the count variable as a FREQ or WEIGHT option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 19:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528131#M144096</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-17T19:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528187#M144118</link>
      <description>&lt;P&gt;Thank you sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;for your time as always a privilege to receive favors from you.&amp;nbsp; My concern is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;why the inline view creation of an extra var is not taken up by proc sql processor for remerge as opposed to clean remerge functionality when the extra var happens to be in source. Does that mean inline view in general is not to be considered an equivalent ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: I am scratching my head as the comparison has gone from remerge to comparison of inline view vs table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:26:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528187#M144118</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-17T22:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528188#M144119</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is interesting, thanks for sharing. I was surprised to see that the inline view doesn't trigger remerging.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Same with an ordinary PROC SQL view:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create view tempv as
select *, ranuni(2718) as j from testdata;
quit;

proc sql feedback _method;
create table from_view_attmpt as
select *, count(*)
from tempv
group by var1,var2,var3;
quit; /* No remerging: &amp;lt;100 obs., thus some of the 100 generated random numbers j were excluded. */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;However, with a &lt;EM&gt;DATA step view&lt;/EM&gt; remerging does occur:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tempdsv / view=tempdsv;
set testdata;
j=ranuni(2718);
run;

proc sql feedback _method;
create table from_dsview_attmpt as
select *, count(*)
from tempdsv
group by var1,var2,var3;
quit; /* Remerging occurs: 100 obs. */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I found a related discussion from 2017 in &lt;A href="https://communities.sas.com/t5/SAS-Programming/PROC-SQL-remerging/td-p/332784" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/PROC-SQL-remerging/td-p/332784&lt;/A&gt;&amp;nbsp;where &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;opened a ticket with Tech Support and apparently this led to &lt;A href="http://support.sas.com/kb/60/119.html" target="_blank"&gt;Usage Note 60119: Certain PROC SQL queries fail to remerge summary statistics in SAS® 9.4&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528188#M144119</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-01-17T22:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528189#M144120</link>
      <description>&lt;P&gt;Thank you sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp; Now this has started to really concern me. Lucky that I am in college and none of my courses had anything to do with SAS. But having said that, I am certain I and many others have offered the remerge based easy/lazy solution to many OPs in our home aka here(sas communities).&amp;nbsp; I wonder what if the scenario happened to be something similar i.e for some reason the vars were dropped in the process and when it hits something of this kind. Lord have mercy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp; I hope you take a look at this thread&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528189#M144120</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-17T22:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528191#M144121</link>
      <description>&lt;P&gt;Turns out that IMHO the SQL processor is very clever at detecting if a remerge is needed or not. Sometimes it gets incomprehensible. For example, compare:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data testdata(drop=i j);
   call streaminit(87878);
   array vars var1-var3;
   do i=1 to 10;
      do j=1 to dim(vars);
         vars[j]=rand('integer', 1, 3);
      end;
      output;
   end;
run;

proc sql;

/* Doesn't remerge */
create view junk as
select *, rand('uniform') as junk from testdata;
select 
    *,
    count(*) as c
from junk
group by var1,var2,var3;

/* Does remerge */
create table junkTable as
select *, rand('uniform') as junk from testdata;
select 
    *,
    count(*) as c
from junkTable
group by var1,var2,var3;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But doing your own remerge can be simple and &lt;EM&gt;natural&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select a.* 
from
(select 
    *,
    sum(var3) as d
 from testdata
 group by var1,var2,var3) as a
natural join
(select * from testdata);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528191#M144121</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-17T22:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528196#M144123</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sir, Does that mean we can blindly trust that embedded intelligence at all times? I can't trust myself. But If that's coming from you, Tom or Reinhard, that does make me feel comfortable. But , what about inline view vs table though? Coffee break!&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Turns out that IMHO the SQL processor "&lt;STRONG&gt;is very clever at detecting if a remerge"&lt;/STRONG&gt; is needed or not. Sometimes it gets incomprehensible. For example, compare:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data testdata(drop=i j);
   call streaminit(87878);
   array vars var1-var3;
   do i=1 to 10;
      do j=1 to dim(vars);
         vars[j]=rand('integer', 1, 3);
      end;
      output;
   end;
run;

proc sql;

/* Doesn't remerge */
create view junk as
select *, rand('uniform') as junk from testdata;
select 
    *,
    count(*) as c
from junk
group by var1,var2,var3;

/* Does remerge */
create table junkTable as
select *, rand('uniform') as junk from testdata;
select 
    *,
    count(*) as c
from junkTable
group by var1,var2,var3;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But doing your own remerge can be simple and &lt;EM&gt;natural&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select a.* 
from
(select 
    *,
    sum(var3) as d
 from testdata
 group by var1,var2,var3) as a
natural join
(select * from testdata);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:50:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/528196#M144123</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-17T22:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/529035#M144478</link>
      <description>&lt;P&gt;This is surprising and a little scary.&amp;nbsp; I've heard real SQL devotees suggest that remerges should be avoided as a rule, because they're such an oddity.&amp;nbsp; I've often relied on remerge, because it's so handy.&amp;nbsp; But I'm starting to question that approach. I too would have expected the inline view to trigger a remerge.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 13:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/529035#M144478</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2019-01-22T13:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/529045#M144484</link>
      <description>&lt;P&gt;Thank you Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp; for chiming in.&amp;nbsp; Hmm (sighs) ,something to deal with &lt;U&gt;"extra caution"&lt;/U&gt; going forward&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 14:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/529045#M144484</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-22T14:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL: Auto Remerge when FROM Table vs FROM (Inline view)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/529125#M144516</link>
      <description>&lt;P&gt;Thank you Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;for raising this issue.&amp;nbsp; I suggest you bring it to tech support's attention, and see what they say.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It feels related to this note, but I don't think it quite fits within the criteria listed.&amp;nbsp; &lt;A href="http://support.sas.com/kb/60/119.html" target="_blank"&gt;http://support.sas.com/kb/60/119.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a simple example, where I would expect the in-line view to trigger remerge, but it does not:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input id ;
  cards ;
1
2
3
3
4
5
;

proc sql ;
  select id,j,count(*) 
  from (select id, ranuni(0) as j from have)
  group by id
  ;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The general rule for when will (should) PROC SQL remerge is:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;This note is generated when a column, listed on the select clause,
is not being used in a summary function and the column is not listed on
the GROUP BY clause.  If the column selected is not used in a summary
function, adding it to a GROUP BY clause prevents the note.&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/techsup/notes/v8/4/308.html" target="_blank"&gt;http://support.sas.com/techsup/notes/v8/4/308.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Feels like a bug to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 17:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Auto-Remerge-when-FROM-Table-vs-FROM-Inline-view/m-p/529125#M144516</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2019-01-22T17:03:43Z</dc:date>
    </item>
  </channel>
</rss>

