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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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