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
Combining two tablesArray Hi, I am currently creating some descriptive statistics for my thesis. I have created a table…
accuracy with large numbers in generatingI would like to generate a new ID variable, which is based on ID1 and ID2. Instead of giving the uni…
Missing value in calculating proportion confidence intervalHi everyone, I'm very new to Stata and learning to use it myself. I am trying to use stata to run fr…
Double Data ComparisonDear all, I am trying to run a double data comparison from a Redcap export and need some additional…
Repeated cross-section binary logit model with time dummies - Survey dataHello, when in comes to repeated cross sections it seems there is always little literature out ther…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with calculating functions over subgroups
Post a Comment