Hello!
I've got a problem: when creating a new variable (region) from several existing variables (one variable for each country) I need to keep the labels (for example, 4 is 'Madrid' and 5 is 'Barcelona').
Given that 'Spain' is a variable taking value from 1 to 17 (one for each Spanish region, labelled 1-AndalucĂa, 2-Asturias, and so on...) and .i for the rest of the countries, and 'N' is another variable taking value from 1 to 99 (one for each region of the country N), how could I merge both variables in a new variable 'REGIONS' without losing the labels of each region, so that for example 1 is AndalucĂa for the country Spain and 1 is Region1 for the country N?
I've tried:
clonevar region = Spain if Spain != .i
so that it clonates Spain with it's labels, but I don't know how to add the other country regions without losing their labels.
Thanks a lot!
I've got a problem: when creating a new variable (region) from several existing variables (one variable for each country) I need to keep the labels (for example, 4 is 'Madrid' and 5 is 'Barcelona').
Given that 'Spain' is a variable taking value from 1 to 17 (one for each Spanish region, labelled 1-AndalucĂa, 2-Asturias, and so on...) and .i for the rest of the countries, and 'N' is another variable taking value from 1 to 99 (one for each region of the country N), how could I merge both variables in a new variable 'REGIONS' without losing the labels of each region, so that for example 1 is AndalucĂa for the country Spain and 1 is Region1 for the country N?
I've tried:
clonevar region = Spain if Spain != .i
so that it clonates Spain with it's labels, but I don't know how to add the other country regions without losing their labels.
Thanks a lot!
Comment