BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
srosenfe
Fluorite | Level 6

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;

1 ACCEPTED SOLUTION
2 REPLIES 2
srosenfe
Fluorite | Level 6

Thank you for the feedback - I ended up using the KEYRESET= not totally clear on each option

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1119 views
  • 0 likes
  • 2 in conversation