Site icon Stata.Professor : Your Partner in Research

Equal and weighted mean with asgen in Stata

Dear Prof. Shah, I am using your asgen command and find it very helpful, thanks! Am I correct with the default option not choosing a variable for the weighted mean, I´ll automatically create an equally weighted mean?
*Example: This creates a mean based on MV_EU1?
bysort Date: asgen MW_return_EU1 = Return if Ranking_EU==1, w(MV_EU1)
 
*Example 2: Creates an equally weighted based on the Return?
bysort Date: asgen EW_return_EU1 = Return if Ranking_EU==1 
Thanks in advance. Regards, Dan
Exit mobile version