I have a dataset of ~100K, and I'd like to collapse the data for variable Alpha into its mean, and variable Beta into a mean weighted by variable Weight. As far as I can tell, all means have to be entirely unweighted or entirely weighted by Weight. Is there any way to do both with one command?
My instinct is to collapse it unweighted, reload the data, and collapse it weighted, and then merge the two. That seems a little bulky, though. Thanks.
Related Posts with Collapsing data by both weighted and unweighted means
egen newvar = divide(existingvar), by(existingvar2)Hi! I know how to perform : Code: egen v5 = sum(var4), by(var1) var1 var4 v5 1 301 4323 1 4…
Store variable names for specific conditionHi all, I wonder if its possible save or store a list of variable names with a specific condition, …
I want to regress the cumulative returns for each month, using*the most recent available data for all other variables.This is what my data looks like for one particular stock with the id 10104 (id variable is PERMNO): …
Endogenous Explanatory Variable in a Multinomial Logit EstimationHi Statalist I am wondering what are the possible options for modelling endogeneity in a multinomia…
How can I convert Variable names into the value of a new variable - in Stata?Dear All, I have a dataset that looks like this: year a b c ... 2000 value value value 20…
Subscribe to:
Post Comments (Atom)
0 Response to Collapsing data by both weighted and unweighted means
Post a Comment