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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.