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

Re: st: fresh p and post file p

Subject   Re: st: fresh p and post file p
Date   Thu, 13 Dec 2007 20:14:56 +0000

Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: Simon Moore <>

Date: Thu, 13 Dec 2007 10:33:21
Subject: st: foreach and postfile

I have a question which I think I already know the answer to (I'm sure 
I've seen this asked on Statalist before but can't find the post).

I'm running something along the lines of:-

postfile coef id var1 var2 var3 using "`dir'\fit.dta", replace
foreach num of numlist 1(1)1000 {
qui logit expcont var1 var2 var3 if id == `num'
post coef (`num') (_b[var1]) (_b[var2]) (_b[var3])
postclose coef

occasionally the logit does not work as planned, gives an error (e.g. 
"[var] not found")  and the foreach loop grinds to a halt.  I would much 
rather capture the error somehow, post it to the file coef and have the 
loop move onto the next iteration. Would anyone here happen to have 
encountered a similar problem and worked out a solution?


*   For searches and help try:

*   For searches and help try:

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