Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: ramdom sampling more than _n or_N


From   <[email protected]>
To   [email protected]
Subject   st: ramdom sampling more than _n or_N
Date   Thu, 12 Jun 2003 10:34:00 +0900 (JST)

Dear listers

I would like to ask that how can we random sampling our dataset more than _n or _N. I think we have to write a program to repeat more times instead. I never write any program before, I also have tried it but it did not work out(it only sampling 1 data and finish) so I would be very appreciate if you could help me. Below is my program;

program define sam1 /* e region Nk: to sampling e(1-841) by region(1-19) no.Nk in each region (more than no. of e in each region) */
local t=1
while `t'<=19{
              local i=1
              while `i'<=`3'{				     
                             keep if region==`t'
                             sample 1, count
			 local i=`i'+1
                            }
              local t =`t'+1
             }       
end

Thank you,
P.Chakkrit
Tokyo, Japan



 


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