Announcement

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

  • Grouping Countries According To Level of GDP per capita

    Hello,
    I am very new to Stata and excuse me in advance if this is somewhat of an easy question to tackle. I have data on the level of GDP per capita for 150 countries in a specific year. I would like to group these countries based on their level of GDP pc in that year in four groups (e.g., above 25,000$, $10,000-$25,000 $5,000-$10,000 and $2,000-$5000). Could you suggest a code to do that? I would be extremely grateful!

  • #2
    The actual code would heavily depend on how your GDP variable is entered. Following the guideline in the FAQ (http://www.statalist.org/forums/help) and post some sample of the country and GDP variable would be helpful.

    There are many ways to do that in Stata, the more intuitive way is also longer, but probably better for learners:

    Code:
    * Assuming your GDP is entered in dollars
    generate gdp_group = .
    replace gdp_group = 1 if gdp > 2000 & gdp <= 5000
    replace gdp_group = 2 if gdp > 5000 & gdp <= 10000
    replace gdp_group = 3 if gdp > 10000 & gdp <= 25000
    replace gdp_group = 4 if gdp > 25000 & gdp < .
    
    * Apply labeling scheme:
    label define lab_gdp 1 "$2000-5000" 2 ">$5000-10000" 3 ">$10000-25000" 4 ">$25000"
    label values gdp_group lab_gdp
    tabulate gdp_group
    A couple things: i) be clearer with the threshold. For example, in your scheme, $5000 can be group 1 and 2; ii) where is < 2,000? Was is omitted by accident?

    When you feel more comfortable, check out -help recode- and -help egen cut-.

    Comment

    Working...
    X