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
Binary dependent variable with time series independent variablesI am looking to predict the probability of recession (US) using various indicators from FRED. My dep…
How to export summary statistics with aweights to word document using ASDOC?I have written the Stata syntax below to export summary statistics to word, but weight is ignored. …
Family SizeDear all, I am having trouble in finding the total number of children in a household where househol…
Alterantives to posting estimation results (ereturn)For a while I am thinking of a better way to post estimation results of my user written commands. Mo…
teffects psmatch: logit failed to estimate propensity scoresHello, I am trying to use teffects psmatch, my code below is specifically: Code: foreach y in 199…
Subscribe to:
Post Comments (Atom)
0 Response to Generating trimestral averages with panel dataset
Post a Comment