## Can someone explain DOW Approach

Solved
Regular Contributor
Posts: 171

# Can someone explain DOW Approach

Hi All,

Some time i am able to understand DOW with small example. If some thing in complex i am unable to catch up how exactly it is working. I saw couple of code in this forum using DOW approach. In those code they are using more than 2 or 3 do until(last.XXX) after that set have (dataset)

Can some one explain with complex example????

Thanks

Sam

Accepted Solutions
Solution
‎08-08-2012 01:59 PM
PROC Star
Posts: 8,164

## Re: Can someone explain DOW Approach

BTW: the easiest way, I think, to follow what is going on during the use of any DOW loop, is to insert "putlog _all_;" statements at strategic locations in your code.  That way, you can see exactly what is resulting from every step of the loop(s).

All Replies
Posts: 1,343

## Re: Can someone explain DOW Approach

I would suggest "The DOW-Loop Unrolled", presented by Paul Dorfman: analytics.ncsu.edu/sesug/2010/BB13.Dorfman.pdf

PROC Star
Posts: 8,164

## Re: Can someone explain DOW Approach

Have you read the following paper: http://support.sas.com/resources/papers/proceedings09/038-2009.pdf

It was written by one of the two individuals who are credited with discovering the concept and explains it via a couple of examples.

Solution
‎08-08-2012 01:59 PM
PROC Star
Posts: 8,164

## Re: Can someone explain DOW Approach

BTW: the easiest way, I think, to follow what is going on during the use of any DOW loop, is to insert "putlog _all_;" statements at strategic locations in your code.  That way, you can see exactly what is resulting from every step of the loop(s).

Regular Contributor
Posts: 171

## Re: Can someone explain DOW Approach

Thank you so much Art and  mkeintz. After reading the those links ...it makes more comfortable , understanding the DOW approach!!!!!!

Super User
Posts: 13,562

## Re: Can someone explain DOW Approach

One of the oddities in the SAS world is refering to a DO UNTIL (usually) program flow structure as DOW.

So what do you call a DO WHILE construct?

I have to admit to having learned a variety of other programming languages before SAS so use of DO UNTIL or WHILE wasn't very confusing. SAS does add a few twists though such as mixing interated and conditional into a single instruction.

PROC Star
Posts: 8,164

## Re: Can someone explain DOW Approach

It's not the do while, or do if construct that defines the DOW loop but, rather, the effect of placing set statements within a loop.  I'm sure there are other ways of getting SAS to do more than it was intended to do, but we haven't figured that out yet.

Posts: 1,343

## Re: Can someone explain DOW Approach

And the "w" in DOW is, for some of us, attributable to the fact that many of us learned about it from Ian Whitlock, who taught all of us many things about effective use and understanding of the language constructs in SAS.   Ian was not the first to show the technique, but probably the most influential.

🔒 This topic is solved and locked.