Bookmark and Share

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


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

[no subject]



input x prob
1 .2
2 .1
3 .3
4 .3
5 .1
end
gen int fw = 100000*prob
expand fw
bsample 10000, weight(fw)
tab x if fw>0

It would be handy if can write this in a single command, something like  -sample(x=1:5, N=10000, prob=(0.2,0.1,0.3,0.3,0.1), replace=TRUE)-  for general use purpose.

Cheers

Ning


Ning Li
Survey Methodologist
Melbourne Institute of Applied Economic and Social Research
The University of Melbourne
Tel:  +61 3 9035 4949   Fax: +61 3 8344 2111
Email: Ning.Li@unimelb.edu.au





*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index