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
Super simple syntax questionI have a variable that contains totals of advertising costs for different products from different ye…
Need some help interpreting fe in StataMPI've been teaching myself STATA code for my research paper. I've copied the code and the output of i…
How to get matching results in combination?Dear all, here is the code: Code: tempfile using * Example generated by -dataex-. To install: ssc …
bugs for reclink?Dear all, Please run the code below, it says something was wrong, how to fix this? Code: tempfile …
How do I extract month and year data from combined variables?Hi, I have 51 state name variables(long data) and income data (e.g.starting from inc_JAN_1996, inc_F…
Subscribe to:
Post Comments (Atom)
0 Response to Programming a loop for non-time series dataset
Post a Comment