Is your question about doing the table look up or the actual Do While?
"Do While" repeats a block of code until a condition changes.
"Do Until" repeats a block of code until a condition is met.
Closely related. Generally there is something inside the block of code controlled by the loop that updates or sets the value(s) used in the condition(s) in Do While/Until statement.
Caution: These two statements are likely the cause of most infinite loops as a poorly stated condition, or not changing the values used in the conditions correctly, means the end condition is never met.
Strongly suggest testing such code with very small data sets with known values so the expected loop behavior should have small run times. If the set doesn't finish in a short time you are likely in an infinite loop and have to interrupt the running code. Hint: SAVE the code before running. You may end up finding it easier to end the SAS process than to just interrupt the code depending on your set up.
Do While, Do Until and Do loops in general are common programming structures and not just SAS but many other language references of such apply. The difference is typically how the conditions are specified. This means you can find lots of examples if not limiting to just SAS.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.