Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: How to (almost) randomly reduce the number of observations?


From   Dimitrije Tišma <[email protected]>
To   [email protected]
Subject   Re: st: RE: How to (almost) randomly reduce the number of observations?
Date   Thu, 22 Apr 2010 12:35:09 +0200

Thanks a lot Buzz, Martin and Maarten, it worked! I apologize for the
belated feedback.

Dimitrije








2010/4/20 Buzz Burhans <[email protected]>:
> Dimitrije,
> Conceptually, could you do something like this, which drops a proportion of
> the ids first, then restores all the observations for that id.  It should
> get you more closer to the proportionate reduction you want in larger
> datasets:
>
>
> program drop tabid
>
> program tabid, sortpreserve
> tabulate id
> end
>
> clear
> sysuse auto
> g id = word(make,1)
>
> count
> tabid
> preserve
> contract id
> l
> set seed 10192010
> drop if runiform()<.5
> tempfile kept
> save `kept'
> restore
> merge m:1 id using "`kept'"
> keep if _merge==3
> count
> tabid
>
>
>
> Buzz Burhans, Ph.D.
>
> Dairy-Tech Group
> So. Albany, VT / Twin Falls ID
>
> Phone: 802-755-6842
> Cell: 208-320-0829
> Fax VT: 802-755-6842
> Fax ID: 208-735-1289
>
> Email: [email protected]
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Dimitrije Tišma
> Sent: Monday, April 19, 2010 2:31 PM
> To: [email protected]
> Subject: st: How to (almost) randomly reduce the number of observations?
>
> Hi,
>
> I would like to ask how to reduce number of observations randomly BUT
> in a way that all observations are kept that are related to the person
> who still in the dataset. Thanks!
>
> Dimitrije
> *
> *   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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index