bw, you have to inform us about any higher order sorting in your data.
 By this I mean, is the data sorted according to subject, subject +
date, etc.?  Can there be more than two treatments for a subject so
that you might require a diathermy[3]?
e.g.
treatment      subject    date
monopolar          1       2006.03.05
bipolar               2       2006.04.11
bipolar               2       2006.05.22
bipolar               2       2006.10.07
monopolar          3       2006.02.15
nodiathrm           4       2006.08.10
diathermy[2]        5       2006.01.23
diathermy[2]        5       2006.03.12
diathermy[2]        5       2006.08.26
This makes a difference, because you are going to be operating on sorted groups.
Here is how you could create a sequence number for each subject and
treatment type (assuming you have a date variable as well), then use
it to change the sequence for diathermy.
bysort subject treatment date : gen tx_seq=_n
replace treatment = "diathermy["+tx_seq+"]" if treatment=="diathermy[2]"
--
David Elliott
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/