Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Referece dummy variable and grouping

    Hi!

    I have a set of numeric values for the variable "country". Is there a command that I can use to make dummy variables whilst grouping these countries into regions? Making one of the regions a reference for the other region-dummies.. Or would there be another way to solve this?

  • #2
    I would probably starting by using the -recode- command with the generate option to get a region variable; then, assuming you are using version 13.1 (you need to tell us if you are using an older version), you can just go ahead and use factor variable notation (see -help fvvarlist-)

    Comment


    • #3
      If you have to have the indicators for some reason you can tab the region variable with the generate option and it will create indicator variables for you. That option creates a 0/1 indicator for each category and you have to treat one of them as the reference in subsequent models. If you use factor variables as Rich Goldstein suggests you can define any reference category you wish.
      Richard T. Campbell
      Emeritus Professor of Biostatistics and Sociology
      University of Illinois at Chicago

      Comment


      • #4
        Apart from the comments from Rich Goldstein and Dick Campbell about - gen - and factor notation, you could use:

        Code:
        . tab region, gen(catregion)
        . tab country, gen(catcountry)
        Also, if you don't want the lowest level as the reference when applying "i." as the factor operator, you may use the - ib# - operator. For example, the reference for country =3, would be done just by typing - ib3.country - .

        Best,

        Marcos
        Last edited by Marcos Almeida; 12 Mar 2015, 13:01.
        Best regards,

        Marcos

        Comment

        Working...
        X