Hi, I am a beginner in Stata. recently I spent a lot of day in creating a panel data, I have a huge dataset, part of my data looks like that, it includes the starting year and the ending year, but I need a year variable, still don't know how to create a year variable
clear
input long group id float(min_year max_year)...(some other variables)
1 109 2015 2018
1 109 2015 2018
2 234 2005 2007
2 234 2005 2007
2 234 2005 2007
3 240 2008 2009
3 252 2010 2012
end
[/CODE]
I want the data looks like that,it will be unbalanced panel data
clear
input long id float(min_year max_year) Year...(some other variables)
1 109 2015 2018 2015
1 109 2015 2018 2016
1 109 2015 2018 2017
1 109 2015 2018 2018
2 234 2005 2007 2005
2 234 2005 2007 2006
2 234 2005 2007 2007
3 240 2008 2009 2008
3 240 2008 2009 2009
3 252 2010 2012 2010
4 252 2010 2012 2011
4 252 2010 2012 2012
end
[/CODE]
many thanks!!!
Related Posts with automatically creating year variable for panel data
How to do a logit random effects in mata?Dear statalists: I want to do a logit random effects in mata.I have refered the xtlogit ,re in Camer…
Spatial Panel Econometric Analysis Omitted Variable problem.Hello. I want to do spatial panel econometric analysis. I'm using gravity model. In the gravitationa…
Significance starsHello, I would like to know if it is possible to display significance stars for the mean which I ha…
OLS, PPML, xtpoisson, xtqpmlHi am running a gravity equation with a large number of countries (i.e. 120 reporter and 120 partner…
T-test for cross sectional time series dataHi, I have weather data for a specific time period 2010-2017 for two cities I was wondering how to…
Subscribe to:
Post Comments (Atom)
0 Response to automatically creating year variable for panel data
Post a Comment