Dear all,

I hope you can help me.

I would like to generate a new variables based on values of another variable. The variable I would like to use has 18 values and I would like to trichotomize it into 3 categories with the values 0, 1, 3.

I tried to use:

gen newvardemo if country_code= 1=1 and if country_code= 2=0

but it appears this is not valid syntax.

Can you help me?