<?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: No BY statement was specified for a MERGE statement even no MERGE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729029#M226842</link>
    <description>&lt;P&gt;The WARNING is a consequence of the way your &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lesysoptsref&amp;amp;docsetTarget=n0hlv62ubu3fa6n1co02ezotijyo.htm&amp;amp;locale=de" target="_blank" rel="noopener"&gt;MERGENOBY System Option&lt;/A&gt; is set.&lt;/P&gt;
&lt;P&gt;Do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mergenoby=nowarn;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;before running the code, and reset it afterwards with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mergenoby=warn;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the original setting.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Mar 2021 12:24:09 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-03-25T12:24:09Z</dc:date>
    <item>
      <title>No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729002#M226826</link>
      <description>&lt;P&gt;Hi all SAS Users,&lt;/P&gt;
&lt;P&gt;Today I face a problem quite strange to me. It displays MERGE even I do not have a MERGE in my statement.&lt;/P&gt;
&lt;P&gt;The code in the log is as below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;474        /*Calculating CHL for each firm per year*/
475        proc means data=work.chl_d noprint;
476        	by gviidkey year;
477        	var S_2DC appday;
478        	id LOC;
479        	Output out=chl_2d_year (keep=gviidkey year LOC CHL_2d_c appdaysum where=(appdaysum &amp;gt;=12))
480        	mean=CHL_2d_c sum(appday)=APPDAYSUM;
483        run;

WARNING: No BY statement was specified for a MERGE statement.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could you please help me to sort it out?&lt;/P&gt;
&lt;P&gt;Warmest regard.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 10:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729002#M226826</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-25T10:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729005#M226828</link>
      <description>&lt;P&gt;I don't see how that could happen, but the cause is most likely because of something that came before this step. What came before?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 10:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729005#M226828</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2021-03-25T10:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729006#M226829</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely &lt;FONT face="courier new,courier"&gt;work.chl_d&lt;/FONT&gt; is not a SAS dataset, but a DATA step &lt;EM&gt;view&lt;/EM&gt; (whose instructions contain a MERGE, but no BY statement). This will become more obvious if you show the &lt;EM&gt;full&lt;/EM&gt; log of the PROC MEANS step, i.e., all the notes up to&lt;/P&gt;
&lt;PRE&gt;NOTE: PROCEDURE MEANS used (Total process time):&lt;/PRE&gt;
&lt;P&gt;because these will contain notes referring to datasets used by the view. Or just submit&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data view=work.chl_d;
describe;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to reveal what's in the view.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 10:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729006#M226829</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-25T10:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729007#M226830</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply, here is the log until it announces the warnings&lt;/P&gt;
&lt;PRE&gt;449        /* Add one-day-ahead eta */
450        options mergenoby=nowarn;
451        data previous_replace_/view=previous_replace_;
452        	merge previous_replace previous_replace
453        	(firstobs=2 keep=eta rename=(eta=eta_lead1));
454        run;

NOTE: DATA STEP view saved on file WORK.PREVIOUS_REPLACE_.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

455        options mergenoby=warn;
456        
457        *Calculating s_2dc (s of two-day corrected method);
458        
459        data chl_d/view=chl_d;/*chl for daily*/
460        	set previous_replace_; /* Replace the filename based on previous step*/
461        	by gviidkey datadate;
462        	year=year(DATADATE);
463        	if last.gviidkey then
464        		eta_lead1=.;
465        	S_2DC=sqrt(max(4*(c-eta)*(c-eta_lead1), 0));
466        
467        
468        	if missing (c) or missing (eta) or missing (eta_lead1) then
469        		S_2DC=.;
470        run;

NOTE: DATA STEP view saved on file WORK.CHL_D.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: View WORK.PREVIOUS_REPLACE_.VIEW used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
17                                                         The SAS System                             22:42 Thursday, March 25, 2021

      
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

471        
472        
473        
474        /*Calculating CHL for each firm per year*/
475        proc means data=work.chl_d noprint;
476        	by gviidkey year;
477        	var S_2DC appday;
478        	id LOC;
479        	Output out=chl_2d_year (keep=gviidkey year LOC CHL_2d_c appdaysum where=(appdaysum &amp;gt;=12))
480        	mean=CHL_2d_c sum(appday)=APPDAYSUM;
481        	/*Explain: mean of all S_2DC of one company in a year is called CHL
482        	sum SC APPDAYSUM means SC is sum of S_2DC and APPDAYSUM is sum of APPDAY*/
483        run;
WARNING: No BY statement was specified for a MERGE statement.&lt;/PRE&gt;
&lt;P&gt;Thank you and warm regards,&lt;/P&gt;
&lt;P&gt;Phil.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 10:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729007#M226830</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-25T10:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729008#M226831</link>
      <description>@FreelanceReinhard nailed it.</description>
      <pubDate>Thu, 25 Mar 2021 10:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729008#M226831</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2021-03-25T10:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729009#M226832</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply. Because it is a large dataset so I want to ask one further question.&lt;/P&gt;
&lt;P&gt;So, we can fix it or we can also leave the warning but the result will not be wrong? I hope that I did not fall into a fallacy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 10:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729009#M226832</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-25T10:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729010#M226833</link>
      <description>&lt;P&gt;So, voilà, a MERGE without a BY statement in the definition of DATA step view&amp;nbsp;&lt;FONT face="courier new,courier"&gt;previous_replace_&lt;/FONT&gt;, which in turn is used in DATA step view &lt;FONT face="courier new,courier"&gt;chl_d&lt;/FONT&gt;. The PROC MEANS step triggers the execution of the both these DATA steps. As a result, log messages related to the DATA steps occur after the PROC MEANS code. But the notes referring to the other datasets/views (which you again didn't show) should have reminded you that DATA step views are involved.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 11:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729010#M226833</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-25T11:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729011#M226834</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;for your dedicated explanation. I just delete the view for the mentioned dataset then rerun the whole code, so the log just gone. It took around 2 hours so I may go to bed and will come back to the result tomorrow morning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards and cheers,&lt;/P&gt;
&lt;P&gt;Phil.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 11:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729011#M226834</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-25T11:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729020#M226838</link>
      <description>&lt;P&gt;So change the way you are doing the look ahead so it does not MERGE without BY.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data previous_replace_/view=previous_replace_;
  set previous_replace;
  set previous_replace(firstobs=2 keep=eta rename=(eta=eta_lead1)) previous_replace(obs=1 drop=_all_) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 12:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729020#M226838</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-25T12:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729029#M226842</link>
      <description>&lt;P&gt;The WARNING is a consequence of the way your &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lesysoptsref&amp;amp;docsetTarget=n0hlv62ubu3fa6n1co02ezotijyo.htm&amp;amp;locale=de" target="_blank" rel="noopener"&gt;MERGENOBY System Option&lt;/A&gt; is set.&lt;/P&gt;
&lt;P&gt;Do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mergenoby=nowarn;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;before running the code, and reset it afterwards with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mergenoby=warn;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the original setting.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 12:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729029#M226842</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-25T12:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729176#M226893</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your suggestion, but I thought I set the option megernoby=warn already in my code, it can be seen from the log I posted previously&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;449        /* Add one-day-ahead eta */
450        &lt;STRONG&gt;options mergenoby=nowarn;&lt;/STRONG&gt;
451        data previous_replace_/view=previous_replace_;
452        	merge previous_replace previous_replace
453        	(firstobs=2 keep=eta rename=(eta=eta_lead1));
454        run;

NOTE: DATA STEP view saved on file WORK.PREVIOUS_REPLACE_.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

455        &lt;STRONG&gt;options mergenoby=warn;&lt;/STRONG&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 18:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729176#M226893</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-25T18:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729196#M226896</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your suggestion, I test and see the chl_d was a view so I delete the view, what I received is : the warning move upto another set of datastep&lt;/P&gt;
&lt;P&gt;After all, I am pretty sure that the warning is caused by this datastep&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;449        /* Add one-day-ahead eta */
450        options mergenoby=nowarn;
451        data previous_replace_/view=previous_replace_;
452        	merge previous_replace previous_replace
453        	(firstobs=2 keep=eta rename=(eta=eta_lead1));
454        run;

NOTE: DATA STEP view saved on file WORK.PREVIOUS_REPLACE_.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

455        options mergenoby=warn;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My guess is, because I turn on and off &lt;STRONG&gt;mergenoby&lt;/STRONG&gt; here, so it does not announce warning here, but afterwards, when I work on this dataset(&lt;CODE class=" language-sas"&gt;previous_replace_&lt;/CODE&gt;), it announces the warning.&lt;/P&gt;
&lt;P&gt;For example&lt;/P&gt;
&lt;PRE&gt;459        data chl_d;/*chl for daily*/
460        	set &lt;STRONG&gt;previous_replace_&lt;/STRONG&gt;; /* Replace the filename based on previous step*/
461        	by gviidkey datadate;
462        	year=year(DATADATE);
463        	if last.gviidkey then
464        		eta_lead1=.;
465        	S_2DC=sqrt(max(4*(c-eta)*(c-eta_lead1), 0));
466        
467        
468        	if missing (c) or missing (eta) or missing (eta_lead1) then
469        		S_2DC=.;
470        run;

&lt;STRONG&gt;WARNING: No BY statement was specified for a MERGE statement.&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE&gt;503        data chl_yc_d;/*chl for yearly corrected daily frequency*/
504        	set &lt;STRONG&gt;previous_replace_&lt;/STRONG&gt;; /* Replace the filename based on previous step*/
505        	by gviidkey datadate;
506        	year=year(DATADATE);
507        	if last.gviidkey then
508        		eta_lead1=.;
509        	s_yc_d=(c-eta)*(c-eta_lead1);
510        	if missing (c) or missing (eta) or missing (eta_lead1) then
511        		s_yc_d=.;
512        		label s_yc_d= daily chl of yearly-corrected method;
513        run;

&lt;STRONG&gt;WARNING: No BY statement was specified for a MERGE statement.&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 19:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729196#M226896</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-25T19:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: No BY statement was specified for a MERGE statement even no MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729203#M226898</link>
      <description>&lt;P&gt;The option must be set to NOWARN when the view is&amp;nbsp;&lt;EM&gt;executed&lt;/EM&gt;, not when it is&amp;nbsp;&lt;EM&gt;defined&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 19:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/No-BY-statement-was-specified-for-a-MERGE-statement-even-no/m-p/729203#M226898</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-25T19:14:29Z</dc:date>
    </item>
  </channel>
</rss>

