Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Looping or macro needed??? - Followup question
From
Sarah Elizabeth Edgington <[email protected]>
To
[email protected], [email protected]
Subject
Re: st: Looping or macro needed??? - Followup question
Date
Fri, 03 Jun 2011 08:30:19 -0700
.
The clear command is not wiping out the log statement. Since you
don't provide info on what you actually did or in what way it isn't
working I can't give you any guidance on what is actually going wrong
with what you've done.
Whether you make one log or eight is entirely a matter of personal
preference. If you wanted to you could even do both by using the
name option on one of the logs (see -help log- for more info on that).
Let's assume you want to do eight separate logs. Your setup might
look like this:
foreach s in aaa bbb ccc ddd eee fff ggg hhh {
log using "P:\ProjectName \logs\logforMat070809_`s'.log", replace
use "P:\ProjectName \Mat070809_`s'.dta, clear
...
log close
}
-Sarah
At 07:28 AM 6/3/2011, Jennifer A Hoff wrote:
OK I got the loop working - Thanks Nick!
Next question is how to deal with making a log file
Do I put the log statement outside the loop and make one log file
containing results of all 8 datasets?
Or do I put the log command inside of the loop and make a log file for
each?
Neither seems to be working on my first attempts.
Is the clear command wiping out the log statement?
foreach s in aaa bbb ccc ddd eee fff ggg hhh {
use "P:\ProjectName \Mat070809_`s'.dta, clear
...
}
---------------------------------------------------------------------------------------------------------
Jennifer Hoff Lindquist
Statistician
Health Services Research and Development
Mailing Address:
VA Medical Center
508 Fulton Street (152)
Durham, NC 27705
(919) 286-0411 Ext. 4054 (New as of 5/18/09)
[email protected]
[email protected]
---------------------------------------------------------------------------------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/