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

st: Re: no stop option


From   "Anthony Gichangi" <[email protected]>
To   <[email protected]>
Subject   st: Re: no stop option
Date   Thu, 16 Oct 2003 09:56:03 +0200

Hi,
You can use capture command to be able to extract the results that
are possible to compute. An the recompute your ttest for valid varlists
like this

local i = 1
while `i' <= 3 {
cap ttest var`i', by(group)
if _rc==0 {
ttest var`i', by(group)
}
local i = `i' + 1
}

You get results for Var1 and Var2

Regards
Anthony



----- Original Message ----- 
From: "Yong-Seok Choi" <[email protected]>
To: <[email protected]>
Sent: Thursday, October 16, 2003 5:11 AM
Subject: st: no stop option


> Dear statalisters,
>
> Here is my problem for which I need your help. (I'm using STATA8.0)
> Simplified form of the data look like...
>
> id   group  var1   var2   var3  var4 .........
> 1      a         1        .       3
> 2      a         3        .       2
> 3      b         1        2      4
> 4      b         2        1      5
>
> I would like to do the mean-difference test for each variables by group.
> So I make the do file containing
>
> local i = 1
> while `i' <= 3 {
> ttest var`i', by(group)
> local i = `i' + 1
> }
>
> Then, ttest for var1 is ok, but with var2 STATA makes error "r(420) 1group
found, 2 required" (because of data missing) and stops without ttesting for
var3.
> Is there any way that I can get the result of ttest for var1 and var3
without being stopped at var2?
>
> PS. I need to have the ttest results for var1 and var3, so I cannot use
"capture" command.
>
> Many thanks in advance.
>
> *
> *   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