SyntaxHighlighter

Friday, December 23, 2011

POINT= vs DO UNTIL on empty dataset

In an earlier post, Hash Object vs Array Order, I need to populate an array from a data set then use the array to validate values in a SAS data step.  I was able to fill the array using a DO UNTIL construct but this technique failed when the data set was empty.

I had to use the SAS debugger (add the / debug option to the top of the data step) to understand what was going on.  I would have thought this would work since it was my understanding that an UNTIL loop gets evaluated at the bottom of the loop.  However, that was not the case as can be seen when stacking the debugger and log windows.

What did work is using the POINT= option to randomly read a row of data by observation number.  That was the solution that worked for me.

No comments:

Post a Comment