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
Related Posts with Question on using collapse
How to expand the variable within group?Here is what I am trying to do I want to make each one of the observations in the following dataset …
One-step stochastic frontier using StataGreetings, dear Statalist members! Could I use Stata to estimate a one-stage stochastic frontier wit…
Force negative time values in 'stset'Dear Stata users, I wonder if there is any way to force negative time values (age-centred) in stset…
Mismatch between date formatted as string and numeric dateDear all, I am processing hourly time series data (DD.MM.YYYY hh:mm), where the date variable is fo…
Stata 18 data editor displaying ampersands incorrectly in string variable observationsI am experiencing an issue with the data editor displaying string ampersands (ASCII Code 38) in Stat…
Subscribe to:
Post Comments (Atom)
0 Response to Question on using collapse
Post a Comment