Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: RE: "if and &" expression in edit


From   "b. water" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: "if and &" expression in edit
Date   Thu, 29 Jan 2009 01:25:42 +0000

Jeph, Howie and Nick,
 
Thank you for your advice & counsel (Nick - for the caveat emptor).
 
Jeph, Howie - !mi and !missing both worked in my stata 8.2! They achieved what I wanted.
 
Nick - I remembered vaguely about .a, .b, etc being the missing values. Some of the data were merged from .dta formed from data entered using epidata and did contained .a for missing values - for the sake of uniformity (and my (then) knowledge of handling of missing values with stata) I have replaced .a with actual "missing" i.e. deleting .a. Of course in light of what you said below with the operand x>=. that middle step was unnecessary. I have compared !=. and x Subject: st: RE: RE: "if and &" expression in edit
> Date: Wed, 28 Jan 2009 19:41:09 +0000
> From: [email protected]
> To: [email protected]
>
> On my Stata 10.1 this is in help for -whatsnew7to8-. In bw's Stata, I
> guess it's in help for -whatsnew7to8- too.
>
> Stata now has multiple missing values! In addition to the
> previously existing ., there is now .a, .b, ..., .z, and you
> can attach value labels to the new missing codes!
>
> One thing to watch out for: Do not type
>
> . stata_command ... if x != .
>
> Instead, type
>
> . stata_command ... if x < .
>
> You need remember this only if you use the new missing values,
> but better to have good habits. The way things now work,
>
> all numbers < . < .a < .b < ... < .z
>
> So, if you wanted to list all observations for which x is
> missing, you would type
>
> . list if x>= .
>
> See help missing.
>
> Nick
> [email protected]
>
> Nick Cox
>
> Nothing to do with either -edit- or -if- or -&-.
>
> The problem, as declared, is a type mismatch.
>
> As -plannedsx- is float it can never be equal to an empty string.
>
> -if plannedsx < .- would be one good way to test whether it was not
> missing.
>
> (I think Stata 8.2 had extended missing values .a ... .z already, so
>
> != .
>
> and
>
> < .
>
> are not the same.) Tony Lachenbruch got a very useful publication in the
> early STB out of explaining that < . was shorter than != . but with
> extended missing values his short-cut really came into his own.
>
> STB-9 ip2 . . . . . . . . . . . . . . . . . . . . . . . A keyboard
> shortcut
> . . . . . . . . . . . . . . . . . . . . . . . . . . P. A.
> Lachenbruch
> 9/92 p.9; STB Reprints Vol 2, p.46 (no
> commands)
> keyboard shortcut to indicate nonmissing values
>
>
> Also, check out the -missing()- function. It may have been called
> -miss()- in Stata 8.2.
>
> ... if !missing(plannedsx)
>
> is how you could do it in Stata 10.
>
> Nick
> [email protected]
>
> b. water
>
> Stata 8.2,
>
> I wanted to do this:
>
> edit if plannedsx!="" & modalit==""
>
> i.e. i wanted to edit those where plannedsx are not missing but where
> modality are missing
>
> and received this message:
>
> type mismatch
> r(109);
>
> The variables descriptions are:
>
> storage display value
> variable name type format label variable label
> ------------------------------------------------------------------------
> -------
> plannedsx float %9.0g planndsx
> modalit byte %1.0f electrosx
>
> Questions are:
>
> 1. How I can achieve what I wanted to do?
> 2. I would appreciate confirmation of this situation: I tried another
> edit with if and & using another conditions and variables, these few
> attempts returned the same type mismatch error r(109) - so I presumed
> edit with if and & is not a legal syntax.
>
>
> *
> * 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/
_________________________________________________________________
Windows Live™ Hotmail®…more than just e-mail. 
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_howitworks_012009
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index