+ Reply to Thread
Results 1 to 2 of 2

Thread: New variable generated from existing data

Hybrid View

  1. #1
    Points: 815, Level: 15
    Level completed: 15%, Points required for next Level: 85

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    New variable generated from existing data

    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!

  2. #2
    Points: 849, Level: 15
    Level completed: 49%, Points required for next Level: 51

    Location
    Stockholm, Sweden
    Posts
    8
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: New variable generated from existing data

    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

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats