Statalist


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

st: RE: constrained sum of random values


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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 
[email protected] 

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