Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

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

Subject |
st: AW: RE: AW: RE: AW: Exclude some observations from a sample in a regression |

Date |
Wed, 7 Apr 2010 15:17:01 +0200 |

<> " You may intend ... if foreign == "foreign":origin" This will lead to no observations r(2000); You must capitalize "Foreign" for this to work: ************* sysuse auto, clear regress price weight length if foreign == "Foreign":origin regress price weight length if foreign == "foreign":origin ************* HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox Gesendet: Mittwoch, 7. April 2010 15:09 An: statalist@hsphsun2.harvard.edu Betreff: st: RE: AW: RE: AW: Exclude some observations from a sample in a regression The overarching principle is that ... if <condition> identifies the maximal subset that will be included. That doesn't stop observations being excluded on other grounds, namely missing values of -rep78- in these examples. Note that ... if foreign == foreign is no exclusion at all, being on all fours with -if 1 == 1- or -if 42 == 42-, that is, it is a tautology, or always true. You may intend ... if foreign == "foreign":origin which is quite different. See SJ-4-4 dm0009 . . . . . . . Stata tip 14: Using value labels in expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K. Higbee Q4/04 SJ 4(4):488--489 (no commands) tips for using value labels in expressions Nick n.j.cox@durham.ac.uk Claude Francoeur Thanks for showing me these different methods. I should have mentioned that I do have missing values in my sample. I'm confused though concerning the right command to use. regress price weight length if foreign returns a regression using 22 observations since there are no missing cases regress price weight length rep78 if foreign returns a regression using 21 observations since there is one missing value under rep78. This seems to be contrary to Nick's comment, but I probably am missing something. regress price weight length rep78 if foreign==foreign returns a regression using all 69 non missing observations including domestic cases. The if command does not seem to be recognised. * * 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/

**Follow-Ups**:**st: RE: AW: RE: AW: RE: AW: Exclude some observations from a sample in a regression***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: AW: RE: AW: Exclude some observations from a sample in a regression***From:*Claude Francoeur <claude.francoeur@hec.ca>

**st: RE: AW: RE: AW: Exclude some observations from a sample in a regression***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: AW: AW: RE: AW: Exclude some observations from a sample in a regression** - Next by Date:
**st: AW: AW: RE: AW: Exclude some observations from a sample in a regression** - Previous by thread:
**st: RE: AW: RE: AW: Exclude some observations from a sample in a regression** - Next by thread:
**st: RE: AW: RE: AW: RE: AW: Exclude some observations from a sample in a regression** - Index(es):