Announcement

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

  • Deleting Cells in Stata: My data looks like "steps"

    Hi,

    First timer here though I have used STATA for quite a while, I have ran into a problem I cannot figure out. I would like to collapse the dataset I am working with so that Table 1 can be transformed into Table 2. I am all out of ideas (have tried merge, collapse, reshape....can't figure this one out).

    Any advice?

    Thank you!

    Cheers,
    Oliver

    Table 1
    Country Var1 Var2 Var3 Var4 Var5 Var6
    Argentina data
    Argentina data
    Argentina data
    Argentina data
    Argentina data
    Argentina data
    Belgium data
    Belgium data
    Belgium data
    Belgium data
    Belgium data
    Belgium data
    Canada data
    Canada data
    Canada data
    Canada data
    Canada data
    Canada data
    .....other countries
    Country var1 var2 var3 var4 var5 var6
    Argentina data data data data data data
    Belgium data data data data data data
    Canada data data data data data data
    ...other countires data data data data data data

  • #2
    If you tried -collapse- you missed the boat somehow.

    Code:
    collapse (firstnm) var1-var6, by(Country)
    will do this.

    It is the norm in this community that we use our real given and surnames as our username, to promote collegiality and professionalism. Please click on "Contact Us" in the lower right corner of this page, and message the administrator to request that your username be appropriately changed. Your cooperation will be appreciated.

    Comment


    • #3
      Hi Clyde,

      Forgot to reply thank you for this answer - it was helpful.

      Cheers,
      Oliver

      Comment


      • #4
        (and I will be changing my name)

        Comment

        Working...
        X