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