Statalist


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

st: RE: question on keeping observations - selecting substitute instituions for sampled institutions


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: question on keeping observations - selecting substitute instituions for sampled institutions
Date   Wed, 6 Jan 2010 13:15:16 +0100

<>

You can -generate- a dummy for "being a substitute". What do you want to happen for adjacent sampled schools? Their substitutes must overlap, such as 324 and 325 in my example:

*******
vers 11

clear*
set obs 4000
set seed 43532

gen int school=_n

gen randomnumber=runiform()
sort randomnumber
gen sampled=_n<=300

sort school

gen byte substitute=sampled[_n+1] | sampled[_n-1]

//problem: sometimes sampled schools adjacent to each other
cou if substitute
l in 322/326

*******


HTH
Martin


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gáti Annamária
Sent: Mittwoch, 6. Januar 2010 12:56
To: [email protected]
Subject: st: question on keeping observations - selecting substitute instituions for sampled institutions

Dear List users,

I am trying to collect a sample out of schools. I have successfully 
sampled 300 institutions out of 4000. I have now a dataset containing 
4000 observations and a variable named sample indicating whether a given 
institution is part of my sample (code=1) or not (code=0).

As I also need 2 substitutes for each institutions I would like to chose 
the ones that are right above and under the sampled school. Is there a 
simple way to do this with stata? I was browsing through the Keep 
observations commands but didn’t manage to find out how to do this.

Thank U in advance

Annamaria
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index