I am trying to encode multiple variables and replace remaining strings with a numeric character - however i am getting an error r(100)


. foreach var of varlist company_23 debt_23 pairincome {
2. encode `var', gen(_`var')
3. replace `var'=0 if `var>2500
}
varlist required
r(100);

How can i solve this?