Statalist


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

st: RE: constrained sum of random values


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: constrained sum of random values
Date   Wed, 25 Mar 2009 19:04:52 -0000

I assume you also mean that they come from a uniform distribution. 

set obs 77
gen x = uniform()
su x, meanonly 
replace x = 9900 * x / r(sum) 

Nick 
n.j.cox@durham.ac.uk 

Carlo Lazzaro

is there any way for imposing Stata 9.2/SE to create a variable composed
of
77 random values so that the sum of these random values is 9900?

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