Thank you for thinking along.
However, it is not a complete answer to my question. I do get all the variables I need, but not the correct value. In your coding the variable "ba" can have cases with different values. In my research there are different ba variables containing the cat values.
E.g. I have a variable named BA1_CAT that can have a value between 1 and 35, a variable named BA2_CAT that can have a value between 1 and 35, and so on this is something I need, because I manualy asign a given word to a numerical category. If for instance the variable BA3_CAT has the value of 22 than BA3_CAT1 to BA3CAT21 are 0, BA3_CAT22 is 1 and BA3_CAT23 to BA3_CAT35 are 0 again.
This leaves me with the problem that I want syntax to recognise a number in the middle of a variable name and create that same number in the middle of a variable along with a second one. Which now it doesn't because it expects an equal sign after an index.