Hello,
I have an unbalanced panel for 24 different companies with monthly data from 1995 to 2019 and 26 different variables . The data was given to me in an excel file and I've successfully imported it to Stata and defined it as a panel. My goal is to generate trimestral averages for each of the 26 variables. My intuition was to use the 'egen' command to generate the averages, however I need to generate an average for each company and the option by is not allowed when using a panel dataset. I found an sac called egenmore but I wasn't able to understand how to use it. An example of what I expect is:
For variable v1, I would like to generate trimestral averages by company.
My dofile goes like this until now:
*Dofile Provisiones
clear
import excel "/Users/nicolasmorales/Downloads/Base Bancos 11-2019.xlsx", sheet("Bancos 12-11-2019") firstrow
encode Entidad, gen(entidad)
drop Entidad
encode v44, gen(v_44)
drop v44
rename v_44 v44
rename Fecha fecha
sort entidad fecha
duplicates report entidad fecha
duplicates tag entidad fecha, gen(ind)
tab ind
drop if ind==1
gen monthly_date=mofd(fecha)
format monthly_date %tm
drop fecha
rename monthly_date fecha
xtset entidad fecha, monthly
Related Posts with Generating trimestral averages with panel dataset
Interpretation of 198% mediation effectHey everyone, I run an insignificant direkt effect of my X and Y variable but I want to test for a …
mutiple graphs in single graphHi, Does anyone knows how to make side by side bar graphs in a single graph? I did the following cod…
2022 Northern European Stata Conference2022 Northern European Stata Conference Oslo, Norway, Wednesday 12 October 2022 First announcement…
Stacked First-Differences Model including IV and Fixed-EffectsHello all, I have panel data on 16 countries for the years 1995 to 2007 (yearly observations). Init…
Graph bar with a grading palette of colorsHi there, I am trying to picture a bar graph. However, instead of randomly selected colours I would…
Subscribe to:
Post Comments (Atom)
0 Response to Generating trimestral averages with panel dataset
Post a Comment