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

From |
Dan Blanchette <dan.blanchette@duke.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: AW: What's the added value of having -in- subset the data before -if- does? |

Date |
Wed, 4 Feb 2009 12:17:44 -0500 (EST) |

The downside to that solution: . bysort foreign: list if foreign & _n <= 10

. bysort mpg: list if mpg < 20 & _n < 10 Also, I realized that since sum() creates a running sum this will not just list the first 10 observations because 0 (false) is also less than 10. So this: . list if sum((foreign == 1)) <= 10 should be: . list if sum((foreign == 1)) <= 10 & foreign == 1 or: . list if inrange(sum((foreign == 1)),2,11) & foreign == 1 A better example to show how the running sum also requires the condition to be repeated would be:

. list if inrange(sum((mpg < 23)),1,10) //correct . list if inrange(sum((mpg < 20)),1,10) & mpg < 20

Yet another learning experience. Dan Blanchette Research Associate Center of Entrepreneurship and Innovation Duke University's Fuqua School of Business Durham, NC USA dan.blanchette@duke.edu

From "Martin Weiss" <martin.weiss1@gmx.de> To <statalist@hsphsun2.harvard.edu> Subject st: AW: What's the added value of having -in- subset the data before -if- does? Date Wed, 4 Feb 2009 17:01:33 +0100<>************* bys for: list if foreign &_n<=10 ************* HTH Martin

* * 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: table & chi-square from multiply imputed survey data (-ice-, -mim-)***From:*"Michael I. Lichter" <mlichter@buffalo.edu>

- Prev by Date:
**Re: AW: st: PC vs AppleMac commands** - Next by Date:
**st: SAS proc autoreg and Stata arima** - Previous by thread:
**st: What's the added value of having -in- subset the data before -if- does?** - Next by thread:
**st: table & chi-square from multiply imputed survey data (-ice-, -mim-)** - Index(es):

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