combine country + year

eva8

New Member
#1
Hi,

I need to combine a numeric variable (year) with a string variable (country). How can I make one variable of these both in spss?
 

Karabiner

TS Contributor
#2
You can use automatic recode in order to create a numerical variable which contains a different code for
each country (let's call it country2), and then you can add them up, e.g. COMPUTE newvar=year*100+country2,
or something like that.

Alternatively, you can duplicate the "year" variable, then turn the duplicated variable into a string variable, and compute
a new string variable from the duplicated "year" variable and the "country" variable, using CONCAT.

With kind regards

Karabiner
 

eva8

New Member
#3
It worked! Thanks a lot!;)
You can use automatic recode in order to create a numerical variable which contains a different code for
each country (let's call it country2), and then you can add them up, e.g. COMPUTE newvar=year*100+country2,
or something like that.

Alternatively, you can duplicate the "year" variable, then turn the duplicated variable into a string variable, and compute
a new string variable from the duplicated "year" variable and the "country" variable, using CONCAT.

With kind regards

Karabiner
Thanks a lot!