Announcement

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

  • Combining the values of different categories into ONE with a repeated ID

    I have a variable (foodgr) which is divided into 4 categories (1,2,3,4).

    I have another variable, volume, which lists the weight of each of these categories.

    I want to create another variable which combines the volume of all of these 4 categories into one.

    The only thing is that the volume for each of these categories was measured every week, and hence I have multiple data entries from the same ID


    Could Anyone please advise me on how to create a new variable where the volume of the foodgr variable is combined?


    THANKYOU

  • #2
    Lak:
    welcome to this forum.
    I'm not clear with what you're after.
    That said, have you already taken a look at -collapse-?
    Kind regards,
    Carlo
    (Stata 15.1 SE)

    Comment


    • #3
      Thanks Carlos I will look into collapse.

      I was wondering if I am able to save collapsed data into a new variable, or if it irreversibly alters my data set?

      Comment


      • #4
        Lak:
        before using -collapse- is a good habit to save in another .dta the dataset to be collapsed.
        Kind regards,
        Carlo
        (Stata 15.1 SE)

        Comment

        Working...
        X