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]

Re: st: problem with marksample touse


From   Xuan Zhang <[email protected]>
To   [email protected]
Subject   Re: st: problem with marksample touse
Date   Thu, 24 May 2012 07:56:17 -0400

Thanks a lot. Nick.

I read the article What is true and false in Stata. It's very helpful.
Cleared my confusions. And thanks a lot for your reply!

Best,

Vicky

On Wed, May 23, 2012 at 4:57 PM, Nick Cox <[email protected]> wrote:
> I've no idea what -shamhaz- is, and you don't say. But
>
> Question 1.
>
> if `touse'
>
> is, as you say, exactly equivalent to
>
> if `touse' == 1
>
> in your case. Let's backtrack.
>
> marksample touse
>
> creates a temporary variable `touse' whose only possible values are 0 and 1.
>
> If you follow through, `touse' can therefore only be evaluated as true
> (non-zero) if -`touse' is 1. For more on this, see (e.g.)
>
> FAQ     . . . . . . . . . . . . . . . . . . . . . . .  True and false in Stata
>        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
>        2/03    What is true and false in Stata?
>                http://www.stata.com/support/faqs/data/trueorfalse.html
>
> To find out what -marksample- does, don't search the web, look at the
> help! It says all you need to know. Even if there are no -if- or -in-
> qualifiers (not options) on a command line, -marksample- still marks
> out as 0 observations that contain missing values for any variables
> named in the command (unless -novarlist- is specified with
> -marksample-).
>
> By the way, your only reference here is "the internet" and I see no
> context, but if -marksample- is explained without mentioning its check
> for missing values, then that's a pretty lousy explanation.
>
> Question 2.
>
> A consequence of -syntax- is that the local macro `weight' is empty,
> i.e. equal to "", if and only if no weights were specified on the
> command line. Weights are not considered to be options. You seem to be
> understanding this, just misusing terminology in how you describe it.
>
> Nick
>
> On Wed, May 23, 2012 at 9:31 PM, Xuan Zhang <[email protected]> wrote:
>
>> In the shamhaz ado file, there are several lines like these:
>>
>> if "`weight'"=="" {
>>                if trim("``opt2''")=="" qui logit `tmplhs' ``rhsvars'' if `touse' &
>> (`tmplhs'==0 | (`tmplhs'==1 & L.`tmplhs'==0 & L.`touse'==1))
>>
>> Question1
>> I have problem understanding what's meaning of  if `touse'. Is it a
>> short version of if 'touse'==1?  I mean after the syntax command, what
>> exactly marksample do to my data? I searched some note on the internet
>> and one of them says "The marksample touse ensures that only
>> observations satisfying the if or in clauses are used." but since
>> there is no if option in the ado code, does that mean that every
>> observation in my data is marked as 1? really confused.
>>
>> syntax varlist(ts) [if] [in] [aweight/] [, *]
>> marksample touse
>>
>> Question 2
>> weight is a macro that STATA keeps it for itself, right? I guess in
>> the first line of the code, if "`weight'"==""  means if there is no
>> option after the logit command, then quietly logit left hand side
>> variable with the right hand side variable without the option. But I'm
>> not sure about that.
>>
>
> *
> *   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/

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