No programming needed.
egen maxte = max(te), by(sector)
gen relte = te/maxte
If no values of -te- were missing, you
could do it in one
bysort sector (te) : gen relte = te/te[_N]
However, the -sort- in -bysort- would
push any missings in -te- to the end,
so the -egen- route is safer.
Nick
[email protected]
P.S. I don't know where year enters into
this, due to ignorance of frontier models.
I stopped studying economics in 1969. But
the basic approach here can be refined.
Vidya Mahambare
>
> I have now created estimates for TE for each sector
> following Nick Cox's
> suggestion. I would now like to compute TE for each firm
> in a sector relative
> to maximum TE in that sector in a particular year.
>
> I am not sure how to proceed, mainly due to the lack of
> understanding of
> programming.
*
* 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/