Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: using egen & fill coupled to another variable?


From   "Ronnie Babigumira" <[email protected]>
To   <[email protected]>
Subject   st: RE: using egen & fill coupled to another variable?
Date   Sun, 26 Jan 2003 20:50:16 +0100

Not sure I understand you, what exactly will be the diffrence between x1 and
x2 (list a few arbitrary entries)


-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of peter
Sent: 26. januar 2003 19:47
To: [email protected]
Subject: st: using egen & fill coupled to another variable?


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/

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