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]

st: use random values in a calculation


From   Zhi Su <[email protected]>
To   statalist <[email protected]>
Subject   st: use random values in a calculation
Date   Fri, 1 Jul 2011 22:46:25 -0400

Dear Statalists,

  I need to generate a set of variables that are som of four variables
v1 v2 v3 v4 multipled by a ratio r1 r2 r3 r4 which are randomly chosen
from (0, 0.05,0.1,0.15,0.2). For example,
s0=v1*0+v2*0+v3*0+v4*0
s1=v1*0.05+v2*0+v3*0_v4*0
s2=v1*0.05+v2*0.05+v3*0+v4*0
.
.
.
s625=v1*0.2+v2*0.2+v3*0.2+v4*0.2

How can I use commands to generate these 625 variables?

Thank you!

-- 
Zhi Su
348 Holmes Hall
Northeastern University
360 Huntington Avenue
Boston, MA 02115
Office:1-617-373-2316
email:[email protected]
*
*   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