Hi,
I am having some troubles in computing functions over subgroups.
Basically, I have some financial data over a time period of 4 years for some firms and I would like to create a variable for the mean or the sum of these data by year. You can see in the attachment how my data looks like.
I tried this code:
bysort Date: egen meanPrice= mean(Price),
but it does not work.
I know that with the commad collapse it works, but then I would need to add the new variable with the old dataset and I cannot it merge it.
Could you please help me?
Thank you in advance!
Related Posts with Problem with calculating functions over subgroups
equality of regression coefficientsI am currently attempting to estimate the relationship between writing improvement (Y) and feedback …
Converting to a date from YMDHello everyone, I have a data set with the variable date in it and it looks like this Code: …
macros in variable nameshi, suppose i have a variables named x1 x2 x3 ....x2000 and had set the following local macro and …
R Loop To get Survey Weighted Counts Code: input person status group angle weight 1 2 3 30 152 2 3 2 29 176 3 2 6 20 146 4 3 6 30 194 5…
Event Study on Panel dataI have a panel data set and I would like to conduct an event study. The variable dif shows the relat…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with calculating functions over subgroups
Post a Comment