Hello, I would like to replace 10 variables with bits of characters.
Code:
foreach i of numlist 1/10 {
clonevar chimiomol`i'=hc_chimiomol`i'
replace chimiomol`i'=subinstr(chimiomol`i',"Imm1","Alemtuz umab",.)
replace chimiomol`i'=subinstr(chimiomol`i',"Imm2","Gemtuzu mab",.)
replace chimiomol`i'=subinstr(chimiomol`i',"Imm3","Ibritum omab",.)
replace chimiomol`i'=subinstr(chimiomol`i',"Imm4","Rituxim ab",.)
}
Command:
(17 real changes made)
(16 real changes made)
(0 real changes made)
(1,400 real changes made)
The problem: When I run the code, there is only the last line is replaced (Imm4 -> Rituximab). In stata command, it tells me that all the patterns have been replaced but this is not the case.
An idea of the problem and how to fix it ?
Thank you.
Comment