DATA Step, Macro, Functions and more

SAS MERGE GENERATING ADDITIONAL ROWS (WHY?)

Reply
Occasional Contributor
Posts: 13

SAS MERGE GENERATING ADDITIONAL ROWS (WHY?)

i'm doing the equivalent of a left join in SAS on approximately 32 million rows.  The output contains 7 additional rows compared to the original.  I looked at the USSGL and there seems to be no pattern as to why it generated addtional rows.  Any thoughts?


 

My code:

DATA WORK.TEST;

MERGE FL_AUG (IN=A) XWALK (IN=B KEEP=USSGL DR_CR_IND);

BY USSGL;

IF (A) THEN OUTPUT;

RUN;

Super User
Posts: 5,498

Re: SAS MERGE GENERATING ADDITIONAL ROWS (WHY?)

Posted in reply to Benbo123321

Have you checked the XWALK data to see if it contains multiple entries for the same USSGL?  That's the most likely culprit.

Respected Advisor
Posts: 4,920

Re: SAS MERGE GENERATING ADDITIONAL ROWS (WHY?)

Posted in reply to Benbo123321

If USSGL identifies unique observations in FL_AUG then 

 

IF A and first.USSGL then output;

 

should solve the problem.

PG
Ask a Question
Discussion stats
  • 2 replies
  • 169 views
  • 1 like
  • 3 in conversation