[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Random number
On second thought, probably not.
My example code generates rndyear on the endpoints about half as often
as interior years. If you want rndyear to be randomly distributed as
an integer on the interval [Min,Max] then you can:
as shown in this example:
range id 1 200000 200000
tab ril if dy==10
di "Percent should be close to 10%"
tab r2 if dy==10
di "Endpoints p=" %3.2f 100/18 ", interior p=" %3.2f 100/9
On 3/8/07, Austin Nichols <firstname.lastname@example.org> wrote:
range id 1 2000 2000
or perhaps you mean
On 3/8/07, Nasreen Khan <NKhan@salud.unm.edu> wrote:
> 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
> I want to create a variable called randomyear such that the year is randomly assignment between minyear and maxyear value.
* For searches and help try: