<?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: The query requires remerging summary statistics back with the original data. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182574#M265285</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh I see~ thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 Nov 2014 23:00:22 GMT</pubDate>
    <dc:creator>JPARK</dc:creator>
    <dc:date>2014-11-22T23:00:22Z</dc:date>
    <item>
      <title>The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182572#M265283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I run the proc sql sas code below, my program keep running and it does not stop&lt;/P&gt;&lt;P&gt;In note, it says&amp;nbsp; the query requires remerging summary statistics back with the original data.&lt;/P&gt;&lt;P&gt;Does anybody know why it keep doing this?&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; comp3 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;select &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;a.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;*, abs(a.roa-b.roa) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;diff_roa, (a.r-b.r) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; pamjone&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; DAPAMJ_1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;a &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;left&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;join&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; DAPAMJ_1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;b&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;on&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; a.sic2=b.sic2 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;and &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;a.fyear=b.fyear &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; a.gvkey^=b.gvkey&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;by &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;a.gvkey, a.fyear, a.sic2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;having abs(a.roa-b.roa)=min(abs(a.roa-b.roa));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 45px;"&gt;&lt;STRONG style="line-height: 107%; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; line-height: 107%; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2014 22:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182572#M265283</guid>
      <dc:creator>JPARK</dc:creator>
      <dc:date>2014-11-22T22:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182573#M265284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because you've selected a.* in your select statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In standard SQL you can only have the group by variables plus the aggregated values, but SAS SQL is different and allows you include other variables and remerges the data together.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2014 22:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182573#M265284</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-22T22:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182574#M265285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh I see~ thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2014 23:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182574#M265285</guid>
      <dc:creator>JPARK</dc:creator>
      <dc:date>2014-11-22T23:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182575#M265286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; It still run forever. I changed my code like below. are there still a problem in my code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; comp3 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;BR /&gt;a.gvkey, a.sic2, a.fyear, a.roa, a.r, abs(a.roa-b.roa) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;diff_roa, (a.r-b.r) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; pamjone&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; DAPAMJ_1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;BR /&gt;a &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;left&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;join&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; DAPAMJ_1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;SPAN style="color: #000000;"&gt;b &lt;/SPAN&gt;on&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; a.sic2=b.sic2 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;BR /&gt;a.fyear=b.fyear &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; a.gvkey^=b.gvkey&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;BR /&gt;a.gvkey, a.fyear, a.sic2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;having abs(a.roa-b.roa)=min(abs(a.roa-b.roa));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;STRONG style="line-height: 107%; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; line-height: 107%; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2014 23:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182575#M265286</guid>
      <dc:creator>JPARK</dc:creator>
      <dc:date>2014-11-22T23:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182576#M265287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How big is your data?&amp;nbsp; &lt;/P&gt;&lt;P&gt;Try it in steps, first join without having clause and see if it runs. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 02:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182576#M265287</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-23T02:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182577#M265288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Looks like a deja vu &lt;/SPAN&gt;to me and I strongly concur with Reeza.&amp;nbsp; There are two possible places that may cause long time running:&lt;/P&gt;&lt;P&gt;1. Reeze pointed out: the having clause.&lt;/P&gt;&lt;P&gt;2. The unequal look up: &lt;SPAN style="color: #000000; font-family: 'Courier New'; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;a.gvkey^=b.gvkey&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Break them into multiple steps to see how it goes. If it is still unbearable slow, then we need to know more specs about your tables, a Hash look up may be available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 03:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182577#M265288</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-23T03:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182578#M265289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also try the equivalent operation (as far as I can tell) as a datastep using random access to your sorted data :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sort data=comp3; by sic2 fyear roa; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data comp3;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set DAPAMJ_1; by sic2 fyear;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;p = _n_ - 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not first.fyear then &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; set DAPAMJ_1(keep=gvkey roa rename=(gvkey=pgvkey roa=proa)) point=p;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;else call missing(pgvkey, proa);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;n = _n_ + 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not last.fyear then &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; set DAPAMJ_1(keep=gvkey roa rename=(gvkey=ngvkey roa=nroa)) point=n;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;else call missing(ngvkey, nroa);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if n(ngvkey, pgvkey) = 2 then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if abs(roa-proa) &amp;lt; abs(roa-nroa) then do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _gvkey = pgvkey;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _roa = proa;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _gvkey = ngvkey;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _roa = nroa;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;else do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _gvkey = coalesce(ngvkey, pgvkey);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _roa = coalesce(nroa, proa);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not missing(_roa) then diff_roa = abs(roa-_roa);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop ngvkey pgvkey nroa proa;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 04:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182578#M265289</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-11-23T04:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182579#M265290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are still including THREE non group by variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Courier New'; background-color: #ffffff;"&gt;, a.roa&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Courier New'; background-color: #ffffff;"&gt;, a.r&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; background-color: white; color: black;"&gt;, (a.r-b.r) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; background-color: white; color: blue;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; background-color: white; color: black;"&gt; pamjone&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How many observations in each of your input datasets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 14:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182579#M265290</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-11-23T14:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182580#M265291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;&lt;P&gt;Should I put those variables in group by?&lt;/P&gt;&lt;P&gt;I have 48,229 observations&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 19:57:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182580#M265291</guid>
      <dc:creator>JPARK</dc:creator>
      <dc:date>2014-11-25T19:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: The query requires remerging summary statistics back with the original data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182581#M265292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;48229 is a moderate size dataset... it shouldn't take forever to process. One problem might come from the combination of the left join and the ABS function. When there is no record on the right side of the join, i.e. when only one &lt;STRONG&gt;gvkey&lt;/STRONG&gt; is present for a given &lt;STRONG&gt;sic2&lt;/STRONG&gt; and &lt;STRONG&gt;fyear&lt;/STRONG&gt;, &lt;STRONG&gt;b.roa&lt;/STRONG&gt; is missing and computing &lt;STRONG&gt;ABS(a.roa-b.roa)&lt;/STRONG&gt; generates a note to the LOG. You could try avoiding those with the changes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy; background-position: initial;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy; background-position: initial;"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt; comp3 &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;&lt;BR /&gt;a.gvkey, a.sic2, a.fyear, a.roa, a.r, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG style="font-size: 10pt; font-style: inherit; font-family: 'Courier New'; background-position: initial;"&gt;case b.roa when . then . else abs(a.roa-b.roa) end &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;as &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;diff_roa, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;(a.r-b.r) &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt; pamjone&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt; DAPAMJ_1 &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;&lt;BR /&gt;a &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;left&lt;/SPAN&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;join&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt; DAPAMJ_1 &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.6000003814697px; font-family: inherit; color: #000000;"&gt;b &lt;/SPAN&gt;on&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt; a.sic2=b.sic2 &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;&lt;BR /&gt;a.fyear=b.fyear &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt; a.gvkey^=b.gvkey&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue; background-position: initial;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;&lt;BR /&gt;a.gvkey, a.fyear, a.sic2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;having &lt;SPAN style="color: #800000;"&gt;&lt;STRONG&gt;(a.roa-b.roa)**2&lt;/STRONG&gt;&lt;/SPAN&gt; = min(&lt;SPAN style="color: #800000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;STRONG&gt;a.roa-b.roa)**2&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; text-indent: 0.5in; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy; background-position: initial;"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black; background-position: initial;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; text-indent: 0.5in; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.8000001907349px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; text-indent: 0.5in; background-color: #ffffff;"&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 20:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-query-requires-remerging-summary-statistics-back-with-the/m-p/182581#M265292</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-11-25T20:59:05Z</dc:date>
    </item>
  </channel>
</rss>

