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.
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.