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

st: RE: RE: Over-riding an error message in a loop (solved)


From   [email protected]
To   [email protected]
Subject   st: RE: RE: Over-riding an error message in a loop (solved)
Date   Thu, 9 Dec 2004 15:16:54 +0100

Thanks Nick for your tip on "capture",  I modified my loops as follows:


forvalues X=1(1)8 {

	forvalues Y=1(1)6 {

		di "Testing Symptom `Y' in session `X'"

		capture kap m`Y'1 m`Y'2 m`Y'3 m`Y'4 if session==`X'

		if _rc==0 {

		kap m`Y'1 m`Y'2 m`Y'3 m`Y'4 m`Y'5 m`Y'6 m`Y'7 m`Y'10 if
session==`X'

		}
	}
}



All the best,

Amani




-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 09 December 2004 14:32
To: [email protected]
Subject: st: RE: Over-riding an error message in a loop

Check out -capture- and -noisily- 

Nick
[email protected] 

[email protected]
 
> I have the following loops:
> 
> forvalues X=1(1)8 {
> 
> 	forvalues Y=1(1)6 {
> 
> 		di "Testing Symptom = `Y' in session `X'"
> 
>      		kap m`Y'1 m`Y'2 m`Y'3 m`Y'4 if session==`X'
> 	}
> }
> 
> I can get the following error message for some situations (e.g. for a 
> combination X==1 and Y==3) as follows:
> 	
> 	There are 4 raters per subject:
> 	too few variables specified
> 	r(102);
> 
> I understand the reason behind the error message, and I need that to 
> be posted on my log file, yet I wish the loops to continue running to 
> the next combination until both finish.
> 
> Is there any special "set ..." or command that I can add to achieve 
> that.
> 

*
*   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/



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