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

Re: st: sampling program help

 From Stas Kolenikov <[email protected]> To [email protected] Subject Re: st: sampling program help Date Tue, 4 Jan 2011 16:27:41 -0600

```This is a starting point (it ignores the prone_flood variable, as I
could not understand how you use it):

recode tot_sansad (8/12=1) (13/14=2) (15/16=3) (17/20=4), gen( samplesize)

generate rnd = uniform()

bysort gp (rnd) : gen byte tosample = (_n <= samplesize)

keep if tosample

On Tue, Jan 4, 2011 at 3:45 PM, george joseph <[email protected]> wrote:
>   Hi,
> I would like to have your help with writing a program to resolve  the
> following sampling issue I have
> I have data on 223 sansads  ( sansad_id) in 19 GPs . The variable
> prone_flood_cyclone (1-4) indicates
> the strength of floods and cyclones in the sansads and tot_sansads
> indicates the total number of sansads in each GP.
>
> I would like to draw a sample of 55 sansads in the following manner.
> 1) The sample should contain sansads from all 19 GPS
> 2) If the  total number of sansads (tot_sansads) in a GP is less than
> 12, we should draw one sansad, if  tot_sansads is between 13 and 14,
> we should draw 2 sansads, if  tot_sansads is between 15 and 16,  we
> should draw 3 sansads, and if  tot_sansads is between 17 and 20, we
>
> The following is the METHOD OF ALLOCATION of the number of SANSADs in
> each of the  GPs giving OVER-WEIGHTAGE to SANSADs Prone to floods,
> cyclones etc.
> If the
> Total number of SANSADs in one GP   :8-12
> Number of SANSADs   to be selected : 1
> Method of Allocation ( based on ne_flood_cyclone)
>       1 to be selected from Code’4 ‘. If Code 4 is ‘NIL’, than 1
> from Code ‘3’. If Code 3 is also’ NIL’,   then 1 from Code’2’. If Code
> 2 is also ‘NIL’, then 1from Code ‘1’.
>
> if
> Total number of SANSADs in one GP   :13-14
> Number of SANSADs   to be selected : 2
> Method of Allocation ( based on prone_flood_cyclone)
>       1 from Code ‘4’+from Code’3’ – otherwise, follow the sequence
> as in sl.1.
> if
> Total number of SANSADs in one GP   :15-16
> Number of SANSADs   to be selected : 3
> Method of Allocation ( based on prone_flood_cyclone)
>       1from Code’4’ +1from Code’3’+1 from Code’2’- otherwise, follow
> the sequence as in sl.1.
> and if
> Total number of SANSADs in one GP   :17-20
> Number of SANSADs   to be selected : 4
> Method of Allocation ( based on prone_flood_cyclone)
>       2from Code’4’+1 from Code’3’+ 1from Code’2’+1 from Code’1’-
> otherwise, follow the sequence as in sl.1.
>
> Could you let me know how I can do this which can be replicated .
> Thanks.
> George
>
> *
> *   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/
>

--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

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