Hello everybody,
I have probably a rather simple question, but I still spent hours to solve it, so maybe one can quickly help me.
At the moment my dataset looks as follows: For each observation I have a variable for each year, e.g. GDP2005, GDP2006 etc., so for each year I have an extra GDP variable.
Now, I would like to generate a year variable which contains values from 2005-2012 and then just have one GDP variable. So at the end I would expand my data set by 8, but reducing the amount of variables.
At the moment it looks like this:
MSACode State GDP_2005 GDP_2006 GDP_2007 GDP_2008 GDP_2009 GDP_2010 GDP_2011 GDP_2012
10180 TX 4815.7 5242.4 5625.7 6095.6 5559.1 5815 6039.2 6396.7
10420 OH 26892.2 27485.4 28460.7 29373.4 28603.5 29218.2 29444.9 30010.7
10500 GA 4770.8 4723 4774.3 4826.1 5031 4976.6 4979.3 5127
10540 OR 3066.3 3346.3 3333.3 3291.6 3219.7 3240.5 3385.2 3530.2
At the end it should look like this:
MSACode Year State GDP
10180 2005 TX 4815.7
10180 2006 TX 5242.4
10180 2007 TX 5625.7
10180 2008 TX 6095.6
10180 2009 TX 5559.1
10180 2010 TX 5815
10180 2011 TX 6039.2
10180 2012 TX 6396.7
Before I have solved it with Excel but I think it is much faster in STATA if you know how to do it. Hopefully somebody can help me.
Many Thanks in Advance
Best Simon
Related Posts with Adjusting the dataset to create a Panel Data Analysis
How to do this testKindly I want to regress this model ( which in model 3 given in a pic below) I want to compare betwe…
Problems with Dynamic Panel Data ModelHello, I'm new here and I'm also new with Stata. I have to do a dynamic panel data analysis of excha…
Stata package for LCA and SEM modelsDears, Can anyone please give me a solution for running the LCA and SEM models in stata. Is there a…
Significance between Kaplan Meier and a line - is it possible?How can I check for significance between Kaplan Meier and a line when using addplot? Obviously, Log …
back transform square-root linear regressionHi all, I have conducted a linear regression where outcome measures were square-root transformed (…
Subscribe to:
Post Comments (Atom)
0 Response to Adjusting the dataset to create a Panel Data Analysis
Post a Comment