Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Random number generation in stata


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: Random number generation in stata
Date   Wed, 8 Nov 2006 13:33:57 +0100

*--------- begin example ------
set seed 123456
clear
set obs 5
gen ob = _n
gen x1 = 1 + int(10*uniform())
gen x2 = 8 + int(8*uniform())
gen x3 = 10 + int(16*uniform())
list
*--------- end example -------



-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

--- Patrick Musonda wrote:
> for example 5 observation with three variables as
> shown below for random numbers 1 to 10, 8 to 15 
> and 10 to 25 respectively as shown below
> 
> ob    x1   x2     x3
> 1      3     12     21
> 2      9     8       18
> 3      0     10     11
> 4     10    10     25
> 5      4     14     19

 

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