Hello,
Forgive me if this is to simple a question, but I cannot seem to make this
work:
I want to use:
egen x1=fill(1 1 1 2 1 1 1 2)
but wish to have values '1' correspond to a percentage of value '1' in another
variable x2.
For example,
if x2 = 1, the egen and fill should generate a '1' say, 70% of the time, and
a '2' 30% of the time for variable x1
similarly if x2 = 2, the egen and fill should generate a '2' say, 70% of the
time, and a '1' 30% of the time for variable x1
I'm sure this is very simple, but so far no joy in getting it to work.
I need a solution for over 100 generated variables, so a 'one-off' solution
will not be too useful.
Thanks very much for any help you can give.
--Peter
--------------------------------------
Dr. P. Reece
[email protected]
--------------------------------------
*
* 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/