[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: Using results from correlation matrices to pinpoint variables |

Date |
Sun, 19 Jun 2005 17:13:57 +0100 |

OK. Suppose you -sort- a numeric variable: sort myvar Then, if at least one value of -myvar- is missing, it follows that the last value will be missing, as any missing values have been -sort-ed to that end. So that you could do this sort myvar if missing(myvar[_N]) drop myvar to get rid of a variable with any missing values. Also, if a numeric variable were all missing, then sort myvar if missing(myvar[1]) & missing(myvar[_N]) drop myvar would drop such a variable. On the whole, however, if <condition> <command> doesn't much feature in decisions on whole variables. -dropmiss- itself just uses -count- for this problem and does nothing to the -sort- order, even internally. Nick n.j.cox@durham.ac.uk > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Alejandro > Delafuente > Sent: 19 June 2005 16:38 > To: statalist@hsphsun2.harvard.edu > Subject: RE: st: RE: Using results from correlation matrices > to pinpoint > variables > > > okey, in that case the solution was: using the command > dropmiss with the > option any, so that all variables with missings would be > dropped out. As for > the if distinction between qualifier and command, that was > already clear to > me, or at least that is what I thought. > Alex > In message > <031173627889364697C50B3B266CBB8A101BC6@GEOGMAIL.geog.ad.dur.ac.uk> > statalist@hsphsun2.harvard.edu writes: > > A thread is best closed by saying what the > > solution was, not that you found a solution.... > > > > Nick > > n.j.cox@durham.ac.uk > > > > Alejandro Delafuente > > > > > many thanks Nick. I sorted out the problem. > > > > > > In message > > > > <031173627889364697C50B3B266CBB8A101BAF@GEOGMAIL.geog.ad.dur.ac.uk> > > > statalist@hsphsun2.harvard.edu writes: > > > > My guess is that what you are getting what you > > > > ask for, but that it is not what you want. > > > > > > > > The difference between > > > > > > > > if <condition> <command> > > > > > > > > and > > > > > > > > <command> if <condition> > > > > > > > > is profound. For one documentation, see > > > > http://www.stata.com/support/faqs/lang/ifqualifier.html > > > > > > > > I am not clear what you want precisely. If you > > > > want to drop a variable if and only if all observations > > > > are missing, then > > > > > > > > . search dropmiss > > > > > > > > for a convenience command. > > > > > > > > Nick > > > > n.j.cox@durham.ac.uk > > > > > > > > Alejandro Delafuente > > > > > > > > > > Dear Nick, thanks for your advice. With some little > > > > > adjustments it worked out! > > > > > Also, taking advantage of your generosity let me ask you a > > > > > quick question: am > > > > > trying to drop some monthly variables in a time sequence > > > > > (from january 1961 to > > > > > dec 2001) with missings in them. My code looks as follows: > > > > > foreach var of varlist jan* feb* ... dec* { > > > > > if `var' ==. { > > > > > drop `var' > > > > > } > > > > > } > > > > > But for some reason it is not working. Can you tell why? > > > > > As always, many thanks. > > > > * > > * For searches and help try: > > * http://www.stata.com/support/faqs/res/findit.html > > * http://www.stata.com/support/statalist/faq > > * http://www.ats.ucla.edu/stat/stata/ > > > > -- > Alejandro de la Fuente > QEH/Department of International Development > Oxford University > * > * For searches and help try: > * http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st:: help file for -lxpct_2-** - Next by Date:
**st: RE: RE: RE: RE: RE: unique value count in several variables** - Previous by thread:
**RE: st: RE: Using results from correlation matrices to pinpoint variables** - Next by thread:
**st: post estimation with xtlogit** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |