Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Looping and replacing embedded text


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: Looping and replacing embedded text
Date   Tue, 8 Nov 2005 21:26:49 +0000

> The above could be simplified to...
>
> foreach state in new enc pac mac{
>    do d:\do\`state'_reg.txt
> }
>
> The relevant section in the manual for this particular command is [P]
> foreach or [P] forval.  On-line help "foreach" of these can be
> obtained by typing -man foreach- (and you may find -man forval- of
> interest as well).  I'm afraid I don't have Stata 9 (I assume) manuals
> to hand at present so could not say if these commands are documented
> elsewhere, perhaps in [U] as they are in the Stata 8 manuals (if I
> remember correctly since I don't have them to hand either!).
>

In my haste to reply I didn't review what I wrote before posting.  The
initial sentence in the above paragraph is wrong, using -forval- in
this situation would not work (although it is a command you may be
interested in).

I highly recommend reading Nick's FAQ's and SJ articles though (and
not just those related to loops), as you will gain many invaluable
insights.

Apologies for the hastiness,

Regards

Neil

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index