Dear Statalists,

I have a dataset with 28 string variables named"ox*tc", and the * represent to number 02, 03, ..., 31. They are all string variables with values ranged from letter "A" to "T". Now I'd like to creat a new variable, counting the total number of "T" or "A" in these variables. I tried foreach loop but it doesn't work, with some issues about the abbreviation.

Code:
foreach v of varlist ox*tc {
  count if ox*tc=="A" | ox*tc=="T"
}
I also tried this one but it still doesn't work.

Code:
forvalues i in 2/31{
foreach v of varlist ox`i'tc {
  count if ox`i'tc=="A" | ox`i'tc=="T"
}
}
I hope to have some suggestions about my mistakes and solutions, thank you very much!