Announcement

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

  • Question on using collapse

    Hi everyone,

    I'm having some doubts on the usage of the -collapse- command and I'm hoping you could help me on this.

    I need to calculate the weighted average of a set of observations by year and municipality, weighted on a given variable (let's call it wgt). Will the following syntax work:

    collapse (mean) var1 var2 [w=wgt] , by(year municipality)

    my question is whether the [w=wgt] will apply to both the means of var1 and var2?

    Thanks!

    Helen

  • #2
    For Stata commands, the specified weight applies to the entire command - in this case, to both means.

    Comment


    • #3
      Also, you could check your results by doing this before collapsing:
      Code:
      mean var1 var2 [aweight=wgt], over(year municipality)
      David Radwin
      Senior Researcher, California Competes
      californiacompetes.org
      Pronouns: He/Him

      Comment


      • #4
        thank you all for the replies!

        Comment

        Working...
        X