Bookmark and Share

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]

st: different handling if missings in programs using syntax varlist [if}


From   Bjorn Van Campenhout <[email protected]>
To   [email protected]
Subject   st: different handling if missings in programs using syntax varlist [if}
Date   Thu, 21 Apr 2011 23:55:54 +0200

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.

Kind regards,
Bjorn
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index