Joe, is this what you want?
foreach name in new enc pac mac {
do d:\do\\`name'_reg.txt
}
You need the double back slash after do, before the macro
variable...alternatively, you could use cd to change the directory
before the loop.
Hope this helps, Tim
On 11/8/05, Joe Crespo <[email protected]> wrote:
> This is a question about running a loop.
>
> I run identical opperations on several data files containing the same
> variables but representing different geographical markets i.e., - US states
> or census regions. As I go through each region the only text in the program
> that changes is the text that identifies that region.
>
> My question is whether I can replace a serious of commands that are
> identical except for a census abreviation which is embedded somewhere in the
> program, with a single command and a  loop that replaces the census
> abreviation anywhere it is found in the program.
>
> For example, can I replace the following lines of commands with a single
> line and a loop?
> _____________________________
>
> do d:\do\new_reg.txt
> do d:\do\enc_reg.txt
> do d:\do\pac_reg.txt
> do d:\do\mac_reg.txt
> _________________________
>
> THanks for any advice. Also if anybody can point to a manual that provides
> advice on the relevant programming language I'd be much obliged.
>
> Thanks.
> Joe
>
> _________________________________________________________________
> Is your PC infected? Get a FREE online computer virus scan from McAfee(r)
> Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
> *
> *   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/