That is really strange. It should update all all matching records. Try this one:
x=1; y=1; OUTPUT;
x=1; y=2; OUTPUT;
x=2; y=1; OUTPUT;
x=2; y=2; OUTPUT;
x=1; z=1; OUTPUT;
x=2; z=2; OUTPUT;
x=3; z=3; OUTPUT;
MERGE Main (IN=InMain) Table; BY x;
PROC PRINT DATA=Updated; RUN;
If you would have used UPDATE instead of MERGE it would yield the result that you indicate.
Regards - Jim.
. . . . . . . . . . . . . . . .
Jim Groeneveld, MSc.
6825 MJ Arnhem
Tel: +31/0 26 376 7365
Fax: +31/0 26 376 7305
My computer has the solutions, I have the problems.
From: Susie Li [mailto:Susie.Li@US.SANOFI.COM]
Sent: Tuesday, November 18, 2003 22:33
Subject: How to do table lookup in SAS when main dataset has multiple
records with the same key
Suppose I have my MAIN dataset (with fields: employee_id table_id), and the
lookup table in TABLE dataset (with fields: table_id value), and I want to
read the value from TABLE into MAIN for every employee:
merge MAIN (in=a) TABLE;
Above will update ONLY one record of the MAIN employees with the value of
Is there any other way to update all employees in MAIN with the same
table_id with its corresponding value in TABLE?
Important: The Information in this e-mail belongs to Sanofi-Synthelabo Inc.,
is intended for the use of the individual or entity to which it is addressed,
and may contain information that is privileged, confidential, or exempt from
disclosure under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or use of, or
reliance on, the contents of this e-mail is prohibited. If you have received
this e-mail in error, please notify us immediately by replying back to the
sending e-mail address, and delete this e-mail message from your computer.