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

st: Looping and replacing embedded text

From   "Joe Crespo" <>
Subject   st: Looping and replacing embedded text
Date   Tue, 08 Nov 2005 15:45:47 -0500

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.


Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ Security.

* For searches and help try:

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