Home Forums ASGEN : Program for the Weighted Average Mean in Stata How to find weighted average mean with asgen using the IF condition

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Dan
    Post count: 118

    Hey Prof. Shah,

    I have another short question regarding the asgen command.
    my if condition ( if Ranking_EU==1) is only observed in December. What I want is to calculate the mean for the whole year. So, ideally use every company in the year and their respective return for every month, which are ranked with a 1 in December.
    As I am thinking, what your command really does, I want to ask if with this command:
    bysort Date: asgen MW_return_EU1 = Return if Ranking_EU==1, w(MV_EU1)
    I think I only consider the returns in December, because from January to November I do not have a ranking.
    Thank you if you can help me out.

    Best Dan

    Attaullah Shah
    Post count: 118

    I am a bit unclear about your question. If you can come up with some dummy data to show me what you expect from using the if condition. asgen behaves like any other Stata program, considering cases where the if the condition is met, and ignoring all others.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.