Rodrigo Brice�o
> I have data about discharges by service in a variable called "servicio". 
> For some reason hospital divided the Obstetrics service in those 6 groups.
> 
> HOSP. OBSTETRICIA
> HOSP. OBSTETRICIA C 
> HOSP. OBSTETRICIA P 
> HOSP. PEDIATRIA
> OBSTETRICIA C
> OBSTETRICIA P 
> 
> What can I do in order to aggrupate the 6 discharges values in a 
> unique service called Obstetrics?  I need this aggrupation in 
> order to calculate Average Lenght of Stay.
I will guess that this is a string variable. 
What unites five of these cases is the occurrence 
of "OBSTETRICIA", so one criterion to catch those is 
if index(servicio, "OBSTETRICIA") 
and for the other case a criterion is 
if servicio == "HOSP. PEDIATRIA" 
or the slightly more general 
if trim(servicio) == "HOSP. PEDIATRIA" 
So what you want might well be (all one command) 
replace servicio = "OBSTETRICIA" 
if index(servicio, "OBSTETRICIA") | 
trim(servicio) == "HOSP. PEDIATRIA" 
Here 
if index(servicio, "OBSTETRICIA") 
is short-hand for 
if index(servicio, "OBSTETRICIA") > 0 
-index()- is documented as a string function. 
The underlying principle behind that short-hand is explained at 
http://www.stata.com/support/faqs/data/trueorfalse.html
or in Stata Journal 2(1), 86-102 (2002): see Section 5
of that article. 
Nick 
[email protected] 
<<attachment: winmail.dat>>