Hi

I am going to classify firms into regions. I have a variable that specifies the firm's locations: "nut2_emp", When I tried to generate the region variable it keeps saying type mismatch. Is there any of specialist to assist me what is the possible problem? Thank you so much.

Cheers,

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input double nut2_emp
20
16
11
16
16
16
16
16
16
16
17
17
15
15
11
11
11
11
16
16
16
15
11
15
17
15
18
15
17
16
16
16
17
16
17
17
17
17
16
15
17
16
17
17
11
17
16
11
17
17
11
17
11
16
17
17
17
17
15
11
16
18
17
17
16
16
11
11
17
17
11
17
17
17
17
17
16
17
11
18
11
30
11
11
30
16
17
17
17
15
18
16
16
15
11
16
16
17
17
17
end
label values nut2_emp nut2_emp
label def nut2_emp 11 " Norte", modify
label def nut2_emp 15 " Algarve", modify
label def nut2_emp 16 " Centro", modify
label def nut2_emp 17 " Lisboa", modify
label def nut2_emp 18 " Alentejo", modify
label def nut2_emp 20 " Azores", modify
label def nut2_emp 30 " Madeira", modify



gen region=0
replace region=1 if nut2_emp=="Norte"
type mismatch

replace region=2 if nut2_emp=="Centro"
replace region=3 if nut2_emp=="Lisboa"
replace region=4 if nut2_emp=="Algarve"
replace region=5 if nut2_emp=="Alentejo"
replace region=6 if nut2_emp=="Azores"
replace region=7 if nut2_emp=="Madeira"
replace region=8 if nut2_emp=="Estrangeiro"