PDA

View Full Version : New variable generated from existing data



bockwurst82
06-25-2011, 10:37 AM
Hi,

I tried to do it myself, but didn't succeed, so I need help.
I have a data set with dlots of variables.
ID, age, ger, fr, ital, and a few more
ger, fr, ital stand for countries, Germany, France and Italy and are either 0 or 1 if the subjects is German, its a 1, if not a 0

I want to generate a new variable origin, with the values "Germany", "France" and "Italy"

So if ger=1 the new variables value should be Germany.

I tried gen and egen, but the best I could do is generate origin and give it numeric values from 0 to 3.

Thanks for your help!

Amir Sariaslan
06-25-2011, 01:04 PM
Dear "bockwurst82",

One alternative is to first create your new country variable with the -egen, group()- command and then label your values according to the countries that you have in your data set.

/Amir