Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: multiple identical .do files

From   "R.E. De Hoyos" <>
To   <>
Subject   st: Re: multiple identical .do files
Date   Thu, 23 Mar 2006 23:21:59 -0000


Try the following:

Save the do-file with the procedures as, say, Open another do-file:

log using results
local fnames file1 file2 file3 file4 file5 file6 file7 file8 file9 file10 //the names of your 10 files
foreach n of local fnames {
use "C:\data\\`n'.dta" //or where ever you data is stored
do "C:\" //rute where you saved


----- Original Message ----- From: "paul d jacobs" <>
To: <>
Sent: Thursday, March 23, 2006 10:44 PM
Subject: st: multiple identical .do files

Hi Stata users:

My issue (which I could not find an answer to in the
archives) has to do with a single .do file I would
like to run on 10 datasets which all have the same
variable names.  Essentially, I am looking for a macro
or loop program that could run the .do file on all ten
datasets without having to update 10 separate .do
files each time I make changes to the original.

More specifically, right now I have 10 .do files and
ten datasets.  Each time I change a command, I have to
resave the file ten times so that it corresponds to
each dataset, run each file, and then use each .log
file to find the particular statistics I want.

Thanks very much for your assistance.
Paul Jacobs

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
*   For searches and help try:

*   For searches and help try:

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