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

st: Re: stepwise with if( exp)


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: stepwise with if( exp)
Date   Wed, 22 Sep 2004 20:55:25 -0400

if() is not proper Stata syntax because -if- is not a function.  There
should always be a space after the -if- and parentheses are only used for
proper order of evaluation of the expression.  The fact that if(mpg>20) may
have worked for some command does not mean that it is proper syntax, just
that sometimes Stata may figure out what you mean.   Always use a space
before and after the -if- option.

Michael Blasnik
michael.blasnik@verizon.net


----- Original Message ----- 
From: "Garry Anderson" <g.anderson@unimelb.edu.au>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, September 22, 2004 8:12 PM
Subject: st: stepwise with if( exp)


> Hi Statalisters,
>
> It seems that combining if( exp) with the sw command produces
>
> varlist required
> r(100);
>
> For example,
> use http://www.stata-press.com/data/r8/auto.dta
>
> sw reg price mpg trunk if(mpg>20),pe(0.20)
> varlist required
> r(100);
>
> reg price mpg trunk if(mpg>20)
> produces results
>
> sw reg price mpg trunk ,pe(0.20)
> does forward selection, and produces results
>
> sw reg price mpg trunk if (mpg>20),pe(0.20)
> does forward selection, and produces results
> (There is a space between if and the left bracket)
>
> Therefore, it appears that -if(exp)- rather than -if (exp)- is causing the
> problem with the sw command. Hoever, -if(exp)- works with the reg command.
>
> I am using the 23Jul executable and 01Sep updates.
> Kind regards, Garry
>


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index