I load a table to do lookups but if I search the table with a key that was just found, I get a not found _IORC_ returned. Do I need to reset something before my next lookup?
LOOKUP KEY = 22 KEY1=ABCTA
PREFIX = 22 PREFIX=D
MATCH GOOD = 22 KEY1=ABCTA
LOOKUP KEY = 23 KEY1=ABCTA
PREFIX = 23 PREFIX=D
NO MATCH FOR = 23 KEY1=ABCTA
Example:
DATA LOOKUP(INDEX=(KEY1));
INFILE LOOKUP END=EOFIND1;
INPUT @1 KEY1 $08.
@10 OUTID $03.;
RUN;
KEY1 = 'ABCTA';
SET LOOKUP KEY=KEY1;
/* CHECK RETURN CODE FROM SEARCH */
SELECT (_IORC_);
/* MATCH FOUND */
WHEN (%SYSRC(_SOK)) DO;
PUTLOG 'MATCH GOOD = ' _N_ KEY1=;
FILE GOOD;
PUT @1 KEY1
@10 STUFF;
END;
/* MATCH NOT FOUND IN MASTER */
WHEN (%SYSRC(_DSENOM)) DO;
_ERROR_=0;
/* RESET VALUES IN PDV FROM LAST MATCHED CONDITION */
PUTLOG 'NO MATCH FOR = ' _N_ KEY1=;
END;
SET LOOKUP KEY=KEY1 /unique;
SET LOOKUP KEY=KEY1 /unique;
Thank you for the feedback - I ended up using the KEYRESET= not totally clear on each option
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.