Recoding/transforming problem

Hello everyone,

As a very begginer in SPSS I would ask you for help with some transformation from table A into table B. I have to recode values of "brand" variable into columns and make 0-1 variables.
I can do it in this particular case in this simple way:

compute GREEN_CARE=0.
compute HENKEL=0.
compute GREEN_CARE=1.

else if ....

but the loop has to be usable with another variable and different number of values ect. I was trying to make it all day and gave up.
Do you have any idea to make it in easy way? Thanks!