Dear all,
I turn to you for advice once again, as I am working for the first time on a dataset that is not in a time series (i.e. year and id are unique identifyers). My dataset looks a bit like the following :
id yearClosed tradeRecievables
113 2015 946440
113 2016 1037787
113 2014 6237883
113 2012 10739971
113 2013 8890283
Id = a corporation and there are thousands per sector, etc. What I am trying to do is generate a new variable that is the average of tradeRecievables[_n] - tradeRecievables[_n-1], per id. The different closing years are not equal accross the companies (some start at 2007 for example), so I need to tell Stata to treat the command by the set of yearClosed per id for all the ids available.
Is there a way to do that?
Thank you so much in advance!
Related Posts with Programming a loop for non-time series dataset
date differences using max values where ID values are duplicateHere is the master data I have. Code: * Example generated by -dataex-. To install: ssc install dat…
Lags for Newey West Standard Errors in fmbHi, I am using the command fmb in order to estimate Fama-Macbeth regressions for my unbalanced pane…
Storing Cumulative Risk ValuesCode Code: use https://data.princeton.edu/pop509/justices2.dta, clear stset tenure, fail(event == 1…
reghdfeHello, I have Stata 15.1 installed and today reghdfe stopped working and gives me the following erro…
How to address two idenpendent random intercepts into melogit?I formulate a equation as y=a0+aX+vi+ut The latter two term are random intercepts. How to code it in…
Subscribe to:
Post Comments (Atom)
0 Response to Programming a loop for non-time series dataset
Post a Comment