BookmarkSubscribeRSS Feed

Hi,


Two variables of the same name are used in a merge without being listed in the by statement is usually unintentionnal (usually done by mistake).

As far I'm aware of, the only way to be informed about it is to display information messages in the log using options msglevel=i;.


But

  • That option is not in the default setting.
  • The message is not really easy to notice (black color) and not listed in the interface

error.JPG

 

 

 

 

  • Other messages which are usually not that relevant popup on the way with this option.


Would it be possible to have a global option called for example mergeoverwrite= (or any other relevant name) with WARN by default (as VARLENCHK=)?

 

data one;
   key=1; x=1; output;
   key=2; x=2; output;
run;


data two;
   key=1; x=5; output;
   key=2; x=6; output;
run;

*options mergeoverwrite=WARN;
options msglevel=i;

data demo;
   merge one two;
   by key;
run;

 

2 Comments
Patrick
Opal | Level 21

I believe you get a truncation warning (or is it a note) if doing this for a variable with different lengths. 

Given all the code that's already implemented in productions globally I certainly can't vote for such a new warning by default. It could be at best an option one can set - and if you want it as the default at your site then define it as part of a .cfg or autoexec or the like.   ...but in the end: Know your data and do proper testing.

Quentin
Super User

Maybe name the option MergeCollision instead of MergeOverwrite?  I think the shipped default would probably have to be NoWarn, even though I would set my default to ERROR.