Statalist The Stata Listserver


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

Re: st: RE: random values


From   Knag Anne-Christine <[email protected]>
To   <[email protected]>
Subject   Re: st: RE: random values
Date   Tue, 19 Jun 2007 14:18:33 +0200

(the 40 days have to be following days, so it is not the 40 days of max
production, just the period of max production)


On 6/19/07 2:08 PM, "Maarten Buis" <[email protected]> wrote:

> keep 40 top production dates:
> 
> gen minusprod = - production
> bys group minusprod: keep if _n <= 40
> 
> select 25 random cases:
> 
> set seed 12345
> gen random = uniform()
> bys group random: keep if _n <= 25
> 
> Hope this helps,
> Maarten
> 
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081 
> 1081 HV Amsterdam
> The Netherlands
> 
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room Z434
> 
> +31 20 5986715
> 
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Knag Anne-Christine
> Sent: dinsdag 19 juni 2007 13:33
> To: [email protected]
> Subject: st: random values
> 
> Dear Statalist-members,
> I have a question about how to pull out random values.
> The data may be summarized as this:
> 
> group    day                 daily production
> 1        42                     1025200
> 1        45                     52000
> 1        etc (up to day 145)    etc
> 2        36                     2355000
> 2        37                     450003
> 2        etc(up to day 150)     etc
> 3        65
> up to group 9
> 
> From each of the nine groups daily production I want to pull out 25 random
> values out of the period where peak production occurs. I have decided a 40
> days interval of peak production in each of the groups. The datasheet
> contains all production days, so I need to first be able to pull out the 40
> days and then find 25 random days within this period.
> Can Stata pull out 25 production days out of the 40 days interval and
> display the results in a table? I would like to run an ANOVA between and
> within groups at these 25 random days in the 40days maximum production
> period.
> Thanks!
> AC
> 
> *
> *   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/

*
*   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/



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