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: different handling if missings in programs using syntax varlist [if}
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: different handling if missings in programs using syntax varlist [if}
Date
Thu, 21 Apr 2011 23:10:57 +0100
I see no puzzle here. In your -foo-, the variable -comment- was
created without reference to -price-. In fact, the rest of the program
had no bearing on that. So, no values were missing.
In -foobar-, things were different. Observation with missing -price-
were excluded.
Sorry, but what's the question here?
Nick
On Thu, Apr 21, 2011 at 10:55 PM, Bjorn Van Campenhout
<[email protected]> wrote:
> Dear statalist,
>
> I have observed different outcomes when I have missing observations in
> programs that use the if qualifier. I was wondering what logic is behind
> this.
> Here is a self-contained example:
>
> sysuse auto
>
> replace price=. if foreign==1
>
> cap pro drop foo
> pro def foo
> syntax varlist
> gen comment="this is only a test"
> end
>
>
>
> cap pro drop foobar
> pro def foobar
> syntax varlist [if]
> marksample touse
> gen comment="this is only a test" if `touse'
> end
>
> foo price
> drop comment
> foobar price
>
> For those who wonder, I am trying to make a program that reports missings
> and want to be able to use conditions in my function calls.
*
* 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/