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

And yet another hash variation.

data want(drop=_: rename=(cust_id=Expected_cust_id p_cust_id=cust_id));
  if _n_=1 then
    do;
      dcl hash h1(dataset:'have(where=(not missing(p_cust_id)))' );
      h1.defineKey('p_cust_id');
      h1.defineData('cust_id');
      h1.defineDone();
    end;
  set have(where=(not missing(p_cust_id)));
  output;
  /* lookup children, counter loop added to avoid endless loops in case of DQ issues */
  do _i=1 to 10000 while(h1.find(key:cust_id)=0);
    output;
  end;
  if _i>=10000 then 
    do;
      putlog "DQ issues found leading to endless loop";
      putlog "Source record is: " _n_ 10. -l;
    end;
run;
IvyHeng88
Calcite | Level 5
Thank you so much @PGStats, awesome simple and straight forward ^_^

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

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 16 replies
  • 6736 views
  • 20 likes
  • 8 in conversation