Announcement

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

  • Merging 15 variables into one

    Hello everyone.

    First post here, so bear with me.

    I am trying to merge 15 variables from the same dataset into one. The variables consist of the same values (1.Very bad, 2. Fairly bad, 3. Fairly good, 4. Very good) but differ in terms of what kind of government handling is in question (var1=economy, var2=crimes, etc.). Ideally, I want to end up with just one variable named 'performance' that aggregates the respondent's answers over the 15 variables but keeps the same values for the new variable.

    Don't know if this is even possible. Hope some of you can help.
    Last edited by Frederik Svejdal; 07 Dec 2022, 12:52.

  • #2
    There could be many ways of doing the aggregation -- you could take the minimum of all the 15 variables, or the maximum, or the median, or (perhaps rounded value of) the mean, or ...

    To help operationalise any of these strategies, you might want to look at the egen command , and its associated functions like rowmin(), rowmax(), rowmedian(), rowmean(), etc:
    Code:
    help egen

    Comment

    Working...
    X