<?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: How to avoid &amp;quot;query requires remerging summary statistics back with data in Developers</title>
    <link>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5084#M2047</link>
    <description>Hi, Cynthia, &lt;BR /&gt;
&lt;BR /&gt;
Apologies for not responding to your last note earlier -- was busy with SAS Server issues.  I appreciate your comments and thoughts, and will put them to good use.</description>
    <pubDate>Mon, 22 Oct 2007 16:42:24 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-10-22T16:42:24Z</dc:date>
    <item>
      <title>How to avoid "query requires remerging summary statistics back with data</title>
      <link>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5080#M2043</link>
      <description>I got the following message when I ran a query:&lt;BR /&gt;
"NOTE: The query requires remerging summary statistics back with the original data."&lt;BR /&gt;
&lt;BR /&gt;
I looked on-line in SAS Technical Support, but did not really understand what I read.  Can someone "out there" please help and tell me if this is a serious error, and possible what I should do to eliminate it?  Thank you so much!!&lt;BR /&gt;
&lt;BR /&gt;
Here is my query and a preliminary data step:&lt;BR /&gt;
&lt;BR /&gt;
data makechoice;&lt;BR /&gt;
%let endfiscaldate = 31Aug&amp;amp;fiscalyr;&lt;BR /&gt;
&lt;BR /&gt;
%let position_dates = ( DatePart(EMPLOYEE_POSITION.POSITION_END_DATE) BETWEEN "&amp;amp;&amp;amp;fiscal_date"d AND "&amp;amp;&amp;amp;endfiscaldate"d);&lt;BR /&gt;
run;&lt;BR /&gt;
%mend fiscal_year;&lt;BR /&gt;
&lt;BR /&gt;
%fiscal_year;&lt;BR /&gt;
&lt;BR /&gt;
/**********************************************************************************************&lt;BR /&gt;
/*** Using SQL, creates the primary data table. 											***	&lt;BR /&gt;
/*********************************************************************************************/&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 CREATE TABLE HFA033Step01 AS SELECT&lt;BR /&gt;
    EMPLOYEE.NAME as EMPLOYEE_NAME FORMAT = $40.,&lt;BR /&gt;
	EMPLOYEE_POSITION.POSITION_END_DATE,&lt;BR /&gt;
	EMPLOYEE_POSITION.POSITION_CONTRACT_TYPE_DESC as POSITION_DESC FORMAT = $40.,&lt;BR /&gt;
	EMPLOYEE_POSITION.POSITION as POSITION FORMAT = $40.,&lt;BR /&gt;
	EMPLOYEE_POSITION.POSITION_TITLE as POSITION_TITLE FORMAT = $40.,&lt;BR /&gt;
	EMPLOYEE_POSITION.POSITION_STATUS as POSITION_STATUS FORMAT = $40.,&lt;BR /&gt;
	EMPLOYEE_POSITION.ASSIGNMENT_GRADE as ASSIGNMENT_GRADE FORMAT = $40.,&lt;BR /&gt;
	EMPLOYEE_POSITION.ASSIGNMENT_SALARY_GROUP_DESC as SALARY_GROUP_DESC FORMAT = $40.,&lt;BR /&gt;
	MAX(EMPLOYEE_POSITION.ANNUAL_SALARY) as ANNUAL_SALARY,&lt;BR /&gt;
	EMPLOYEE_POSITION.POSITION_EMPLOYEE_CLASS as EMPLOYEE_CLASS FORMAT = $40.,&lt;BR /&gt;
	EMPLOYEE_POSITION.POSITION_EMPLOYEE_CLASS_DESC as EMPLOYEE_CLASS_DESC FORMAT = $40.,&lt;BR /&gt;
	POSITION_BUDGET.FISCAL_YEAR as FISCAL_YEAR,&lt;BR /&gt;
    POSITION_BUDGET.FISCAL_YEAR_START_DATE,&lt;BR /&gt;
	POSITION_BUDGET.FISCAL_YEAR_END_DATE,&lt;BR /&gt;
	POSITION_BUDGET.POSITION FORMAT = $40.&lt;BR /&gt;
FROM ODSH.EMPLOYEE AS EMPLOYEE &lt;BR /&gt;
	LEFT JOIN ODSH.EMPLOYEE_POSITION AS EMPLOYEE_POSITION ON (EMPLOYEE.PERSON_UID = EMPLOYEE_POSITION.PERSON_UID)&lt;BR /&gt;
	    LEFT JOIN ODSH.POSITION_BUDGET AS POSITION_BUDGET ON (EMPLOYEE_POSITION.POSITION = POSITION_BUDGET.POSITION)&lt;BR /&gt;
	WHERE ( EMPLOYEE.TERMINATION_DATE IS NULL ) AND&lt;BR /&gt;
	      (  EMPLOYEE_POSITION.POSITION_END_DATE IS NOT NULL )AND&lt;BR /&gt;
          (  EMPLOYEE_POSITION.POSITION_CONTRACT_TYPE_DESC = 'Primary' ) AND&lt;BR /&gt;
          (  EMPLOYEE_POSITION.POSITION_STATUS NE 'T' ) AND &lt;BR /&gt;
		  (  POSITION_BUDGET.FISCAL_YEAR = "&amp;amp;fiscalyear" ) AND&lt;BR /&gt;
          &amp;amp;Position_Dates&lt;BR /&gt;
GROUP BY EMPLOYEE_NAME&lt;BR /&gt;
ORDER BY EMPLOYEE_NAME;&lt;BR /&gt;
&lt;BR /&gt;
QUIT;</description>
      <pubDate>Mon, 15 Oct 2007 19:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5080#M2043</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-15T19:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid "query requires remerging summary statistics back with data</title>
      <link>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5081#M2044</link>
      <description>Hi:&lt;BR /&gt;
  In your LOG, by now, you probably have seen: NOTES, WARNINGS and ERRORS. NOTES are just that -- NOTES -- they indicate that something is happening that you may or may not be aware of. It's not an error. In your case, remerging happens usually when you use a SAS function (like SUM or MAX) without using a GROUP BY in the SQL, as described in these 2 papers:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi28/103-28.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi28/103-28.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi29/268-29.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi29/268-29.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
which I found as the first 2 hits by putting the entire text of the note into a GOOGLE search box. There are also some SAS-L postings on topic that I didn't bother to put here.&lt;BR /&gt;
&lt;BR /&gt;
If you go to here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup" target="_blank"&gt;http://support.sas.com/techsup&lt;/A&gt;&lt;BR /&gt;
and find the search box on the right hand panel (in the gold-colored section) and paste the entire note in the search box, you will come up with this hit as the first hit:&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/unotes/SN/004/004308.html" target="_blank"&gt;http://support.sas.com/techsup/unotes/SN/004/004308.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 15 Oct 2007 19:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5081#M2044</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-10-15T19:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid "query requires remerging summary statistics back with data</title>
      <link>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5082#M2045</link>
      <description>And thanks!  Got it, read it and understood it!  Yesit was due to having a MAX phrase in my PROC SQL that I took care of and fixed the note.&lt;BR /&gt;
&lt;BR /&gt;
As always, I appreciate your help and knowledge.</description>
      <pubDate>Mon, 15 Oct 2007 20:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5082#M2045</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-15T20:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid "query requires remerging summary statistics back with data</title>
      <link>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5083#M2046</link>
      <description>Hi,&lt;BR /&gt;
  That's good. BTW, I meant to comment on this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data makechoice;&lt;BR /&gt;
%let endfiscaldate = 31Aug&amp;amp;fiscalyr;&lt;BR /&gt;
&lt;BR /&gt;
%let position_dates = ( DatePart(EMPLOYEE_POSITION.POSITION_END_DATE) BETWEEN "&amp;amp;&amp;amp;fiscal_date"d AND "&amp;amp;&amp;amp;endfiscaldate"d);&lt;BR /&gt;
run;&lt;BR /&gt;
%mend fiscal_year;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
I see 2 issues in the above code:&lt;BR /&gt;
1) no SET statement&lt;BR /&gt;
2) use of %LET instead of CALL SYMPUT.&lt;BR /&gt;
I do NOT see a SET statement in your DATA step. So, I don't understand what you want your DATA step to do. The %LET is a compile time statement. That means, that the value of &amp;amp;endfiscaldate and of &amp;amp;position_dates will only be set ONE time. So, just FYI -- if you have a data set that has POSITION_END_DATE  as a variable and you want that data set variable to be used to give values to macro variables, then you need to investigate the CALL SYMPUT statement. Using %LET in a DATA step rarely gives you the results you expect.&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
If you were building &amp;amp;endfiscaldate and &amp;amp;position_dates from MACRO variables (and NOT data set variables), then %LET is fine and does not need to be inside a DATA step program. -- but then the syntax of your %LET statement needs some work.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 16 Oct 2007 18:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5083#M2046</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-10-16T18:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid "query requires remerging summary statistics back with data</title>
      <link>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5084#M2047</link>
      <description>Hi, Cynthia, &lt;BR /&gt;
&lt;BR /&gt;
Apologies for not responding to your last note earlier -- was busy with SAS Server issues.  I appreciate your comments and thoughts, and will put them to good use.</description>
      <pubDate>Mon, 22 Oct 2007 16:42:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-avoid-quot-query-requires-remerging-summary-statistics/m-p/5084#M2047</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-22T16:42:24Z</dc:date>
    </item>
  </channel>
</rss>

