This code
replace Y = 0 if "`T'" == "" & id == `i' & Month == `m'
replace Y = 1 if "`T'" == "CAB" & id == `i' & Month == `m'
replace Y = 2 if "`T'" == "OXY" & id == `i' & Month == `m'
replace Y = 3 if "`T'" == "OTH" & id == `i' & Month == `m'
replace Y = 4 if "`T'" == "CAB OXY" & id == `i' & Month == `m'
replace Y = 5 if "`T'" == "CAB OTH" & id == `i' & Month == `m'
replace Y = 6 if "`T'" == "OTH OXY" & id == `i' & Month == `m'
replace Y = 7 if "`T'" == "CAB OTH OXY" & id == `i' & Month == `m'
would be better as
if "`T'" == "" replace Y = 0 if id == `i' & Month == `m'
else if if "`T'" == "CAB" replace Y = 1 if id == `i' & Month == `m'
...
else if "`T'" == "CAB OTH OXY" replace Y = 7 if id == `i' & Month ==
`m'
Nick
[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/