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: Confirming whether a variable is binary or continuous


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Confirming whether a variable is binary or continuous
Date   Sat, 17 Mar 2012 07:05:00 +0000

Variations on this are often used inside Stata commands

sort var
assert var == var[1] | var == var[_N]

Here -var- must be one of two distinct values, but nothing specifies
what they are precisely.

Nick

On Fri, Mar 16, 2012 at 11:39 PM, daniel klein
<[email protected]> wrote:
> Nick,
>
> very smart solution, thanks. Seems it is often the simple solutions
> that are so hard to find.
>
> The difference to the "-tabulate- solution" is that <var> is allowed
> to be a constant here, which is perfectly alright for a binary
> variable. It is for Bert to decide whether the indicators are allowed
> to be constant or have to vary.
>
> Daniel
>
> --
> You can also do this by e.g.
>
> assert inlist(var, 0. 1)
*
*   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