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

From |
"Kieran McCaul" <kamccaul@meddent.uwa.edu.au> |

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

Subject |
st: RE: using the first n observations in a dataset w/o evaluating the whole thing? |

Date |
Fri, 4 Apr 2008 07:54:44 +0800 |

Try: use in 1/100 using mydata, clear ______________________________________________ Kieran McCaul MPH PhD WA Centre for Health & Ageing (M573) University of Western Australia Level 6, Ainslie House 48 Murray St Perth 6000 Phone: (08) 9224-2140 Phone: -61-8-9224-2140 email: kamccaul@meddent.uwa.edu.au http://myprofile.cos.com/mccaul _______________________________________________ -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Rodini, Mark Sent: Friday, 4 April 2008 7:32 AM To: statalist@hsphsun2.harvard.edu Subject: st: using the first n observations in a dataset w/o evaluating the whole thing? Greetings. Suppose I have a large Stata dataset (e.g. 3,000,000 observations) and I only with to read in the first, say, 100 observations. I have tried the code, which works: use mydata if ( _N<100 ) However, evidently, this code goes through ALL 3 million observations to evaluate the expression in parentheses, which can be very time consuming (and sort of defeats the purpose). Is there a way to only read the first 100 observations without having to evaluate the entire dataset? Perhaps some application of the "set obs 100"? But I have not been successful. Thank you. -Mark ---------------------------------------------- Mark Rodini mrodini@compasslexecon.com * * 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/

**References**:**st: using the first n observations in a dataset w/o evaluating the whole thing?***From:*"Rodini, Mark" <mrodini@compasslexecon.com>

- Prev by Date:
**st: using the first n observations in a dataset w/o evaluating the whole thing?** - Next by Date:
**Re: st: using the first n observations in a dataset w/o evaluating the whole thing?** - Previous by thread:
**st: using the first n observations in a dataset w/o evaluating the whole thing?** - Next by thread:
**Re: st: using the first n observations in a dataset w/o evaluating the whole thing?** - Index(es):

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