Statalist The Stata Listserver


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

Re: st: Random number


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: Random number
Date   Thu, 08 Mar 2007 20:50:51 +0100

Nasreen Khan schrieb:
> Dear All,
>
> I need some help in figuring out the codes
>
> I want to assign a random number based on the values of two variables.
>
>
> My data set looks like this.
>
> ID       Minyear                      Maxyear
> Nancy     1993                        1994
> Ramon    1996                        1999
> Eva         1992                        1992

  gen ryear = int(uniform()*(maxyear-minyear+1)) + minyear


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