# RE: st: SAS to Stata do instruction

 From "Grochulski, W. Daniel" To "'statalist@hsphsun2.harvard.edu'" Subject RE: st: SAS to Stata do instruction Date Thu, 28 Aug 2003 11:52:07 -0400

```I believe my previous post answers (indirectly) this question, but to
clarify the SAS loop syntax used, here's the explanation:

DO LN_TIME=-1 TO LN_MAX] BY INC, LN_MAX;

requires repeated computations of LN_TIME starting from -1 and then adding
the INC so long as the result is not exceeding LN_MAX; when this happens
compute one more time for LN_TIME exactly equal to LN_MAX. Comma separates
this additional computation from the regular loop and one can specify a
whole list here, like

do x = a to b by c, d, e, f;

where we go looping by increment c from a to b and then we also do d, e and
f.

Hope this helps ,

Daniel.

-----Original Message-----
From: Joseph Coveney [mailto:jcoveney@bigplanet.com]
Sent: Thursday, August 28, 2003 10:44 AM
To: Statalist
Subject: Re: st: SAS to Stata do instruction

Kevin Crow wrote in his response to Giulio Rizzoli's request to translate
SAS
code into Stata code, "If you could explain what the below syntax does in
SAS I
believe I could recreate the results in Stata.

[DO LN_TIME=-1 TO LN_MAX] BY INC,LN_MAX;"

If anyone on the list knows what the answer is to Kevin's question, I'd
appreciate to learn it, too.  And I'd be curious as to whether Stata can
perform the analogous operation (whatever it is), either by a straight mimic
of
SAS as Kevin illustrates as a courtesy to accustomed SAS users for ease of
transference to Stata, or by a more native Stata implementation that Kit
Baum
illustrates.

Joseph Coveney

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```