Dear Statlist users,
I currently face some problems in generating a random sample of integers with unequal probabilities for the intervall 0,3. The current version of stata is stata14. I used the following code:
Code:

gen i = runiformint(0,3) if g106==95
g106 is the variable in the dataset for which I wanted to generate random numbers.
Code:

tab i i | Freq. Percent Cum. ------------+----------------------------------- 0 | 1,467 24.79 24.79 1 | 1,513 25.57 50.36 2 | 1,493 25.23 75.60 3 | 1,444 24.40 100.00 ------------+----------------------------------- Total | 5,917 100.00
This generates random numbers with equal probabilities but I want to generate random numbers from 0 to 3 with different probabilities (eg. 0 probability 0.1, 1 probability 0.4, 2 probability 0.3, 3 probability 0.2) Does anyone know how to generate random numbers with unequal probalities? Thanks a lot in advance.