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
Breusch-Pagan LM Test for Random Effect ModelHi everyone, I'm confused by xttest0 result and wondering about this result inference. My data cons…
How to create treated column after policy effective dateDear All STATALIST members I have a quick question about making treated column after policy effecti…
If Command executed when condition is falseHi everyone Stata 16 I run capture regress and have an if-else command to handle errors. The data s…
Simulating data with summary statistics from empirical dataI have some empirical data, and I'd like to simulate multivariate normal data with the same mean and…
Removing the intermediate 0 from string variableHey everyone, I have a string variable 'p2' that consists of ID codes formatted as follows "BBSC012…
Subscribe to:
Post Comments (Atom)
0 Response to Generating trimestral averages with panel dataset
Post a Comment