Why would you change the 2nd dow loop until condition? Yes, in this case it will produce the same result, but with a warning that the variable 'last.marks' has never been initialized.
And, if you included a 'by marks' statement in your revised code it would only produce one record.
I suggest you read up on what a DOW loop is and how it works (see: https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwi1yJWywZXVAhVryoMKHSYVA1UQFggvMAE&url=http%3A%2F%2Fsupport.sas.com%2Fresources%2Fpapers%2Fproceedings09%2F038-2009.pdf&usg=AFQjCNEO9qKX1DUwx_xXL7Mn4obLWAP6KQ )
Art, CEO, AnalystFinder.com
... View more