Jeremy,
I don't think you can't do it in one line. Even if you could, I think
that it would be a bad idea for more advanced uses of -egen-. Imagine
trying to understand (or even program!) something like:
egen x = 2+5*log(seq(), from(1) to(10) by(region))
On the other hand, with -generate- you can mix all the functions you
want, like in:
generate x = 3 * (price + mpg) / 2
Which is similar to what you did, except for the treatment of missing values.
Cheers,
Sergio
On 1/5/07, Jeremy Miles <[email protected]> wrote:
Hi All,
[Possibly foolish beginner question here.]
Am I missing something obvious here, when I try to combine two steps
into one line:
. sysuse auto
. egen x = rowmean(price mpg) * 3
Stata says:
varlist not allowed
r(101);
For:
. egen x = 3 * rowmean(price mpg)
Stata says:
r(198);
(Invalid syntax)
I can do it in two steps, but that seems inelegant. Have I missed
something obvious?
Thanks,
Jeremy
--
Jeremy Miles
www.jeremymiles.co.uk
*
* 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/