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
collapse or Roger Newman's xcollapse with string variablesTried help (and the help for xcollapse) but can't get an answer that makes sense to me. I have three…
Why does teffects psmatch number of observations not match number of treated + number of controls with 1 match per treated?My data have 200 treated units and 9,800 untreated units. When I run teffects psmatch using default …
Calibration Plot - Cox PH ModelHello, I would like to create a calibration plot of my cox proportional hazard model. I ran goodnes…
IVprobit with 2 endogenous regressorsDear all, I have a regression with binary outcomes and two endogenous continuous regressors. When I…
How to take individuals for which info is available in both waves only?Hi, I am working with BHPS dataset. I have appended Waves 9 & 10 and have declared it as panel. …
Subscribe to:
Post Comments (Atom)
0 Response to Problem with calculating functions over subgroups
Post a Comment