DATA Step, Macro, Functions and more

Messages in the log.

Posts: 0

Messages in the log.

Two tables:

A with variables ID, X, Y.
B with variables ID, Z


data C;
merge A B;
by ID;

If anyone of A and B is not sorted by ID, shouldn't there be a message in the log about it?
Super Contributor
Posts: 359

Re: Messages in the log.

Only if they are not in the correct order. The message is generated when data lines are encountered in the wrong order, not due to a sort indicator.
Posts: 0

Re: Messages in the log.

Thanks for your answer.

In my example above table A was sorted by ID with PROC SORT, but table B was not.

So, since there was no message concerning table B, I can draw the conclusion, for sure, that the records in B was in correct order?

You NEVER have to worry when there is a BY in the merging, that you get something that you don't want?
Super Contributor
Super Contributor
Posts: 3,174

Re: Messages in the log.

As long as you do not code the BY statement parameter NOSORTED. Useful reading below, for your consideration.

Scott Barry
SBBWorks, Inc.

SAS Language Reference: Concepts, Processing BY-Groups in the DATA Step
Respected Advisor
Posts: 3,777

Re: Messages in the log.

MERGE does not support BY statement with NOTSORTED option.
Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation