Is anyone familiar with "while" loops?
I am trying to run a loop where an array of ICD10 codes is matched against the patient's problem list. I want it loop through all of the ICD10 codes i ask it to until it finds a match.
The FOR-DO loop will slow the search way down. Any help would be GREATLY appreciated. Thanks,
Not much difference between a while and for loop. It really is a matter of style.
With the while loop, you exit the loop when your defined condition is no longer met and that has it's uses, but I typically will utilize a for loop with a break command once my condition is met.
for ...
condition met
break
endfor
Does what you want and exits the loop preventing unwanted iterations once your condition is met. I suspect that is your concern?
I do this routinely in identifying patients with a given Dx by IC10 codes. I have a dashboard for monitoring compliance with PQRI/NQF measures which requires this to be done. In addition, I use similar code for checking if the patient is on a given drug class. The code is more than fast enough. If you would like a copy of the code, contact me directly. Delighted to talk to you. Agree with prior post.
If you are doing this through SQL, another option is to join the two sets and see if you have a result. You could store the result in a temporary table and continue on your processing. This will increase your performance because you don't have to loop through every record.
I agree with @carlosjr... a table join would be the proper way to achieve this. If you're in CPS, you'd link on PROBLEM.ICD10MasterDiagnosisID > MasterDiagnosis.MasterDiagnosisID. The MasterDiagnosis table will contain the ICD10 code. That should get you what you need.
Exactly right. Thank you so much. Works perfectly!