Announcement

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

  • Saving variables after collapse

    Dear Statalist:

    My goal is to aggregate individual-level data (e.g., age, sallary, etc.) to the organizational-level with average values. I wonder how I can accomodate the values I obtain from using the collapse command to the working dataset. Thanks.

  • #2
    The easiest way is to not use collapse. Instead you can create those variables with egen
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      If for some reason you need to use collapse, you can then use merge to add the collapsed results to the matching observations in the individual dataset.

      Comment


      • #4
        Thanks for your replies. I've been using egen, but the problem is that my dataset has become large (60GB), and takes so much time for running a single line. I thought using the collapse command would reduce unneccesary variables and increase computing speed.

        Comment


        • #5
          Ok, maybe look at gtools ( https://gtools.readthedocs.io/ ).
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            Thanks for gtools. It's much faster indeed!

            Comment

            Working...
            X