Hi all,
I am working with macroeconomic variables of different economies in Euro area and need to transfer yld_spread and inf_exp of every country and every year in an excel file. So the excel file will contain four different columns: Year, Country, Yld_spread and inf_exp. It will be something like this:
2010 EU ....x1... y1....
2011 EU ...x2.. ...y2....
.
.
2010 DK .....x1.... ...y1...
2011 DK .....x1.... ...y1...
...
2016 DK .... x7.... ....y7....
x_i and y_i are the yld_spread and inf_exp (arranged in two separate columns) of that country and the particular year and i = 2010, ...., 2016.
The code I have used is:
putexcel A1=("year") B1=("Country") C1=("yld_spread") D1=("inf_exp")
local row=2
foreach num of numlist 2010/2016 {
putexcel A`row'=("`num'")
putexcel B`row'=(country)
putexcel C`row'=(yld_spread) if year==`num'
putexcel D`row'=(inf_exp) if year==`num'
local ++row
}
But Stata is giving an error. Can someone point out to my mistake and help me write the right code?
Thanks,
Amit
I am working with macroeconomic variables of different economies in Euro area and need to transfer yld_spread and inf_exp of every country and every year in an excel file. So the excel file will contain four different columns: Year, Country, Yld_spread and inf_exp. It will be something like this:
2010 EU ....x1... y1....
2011 EU ...x2.. ...y2....
.
.
2010 DK .....x1.... ...y1...
2011 DK .....x1.... ...y1...
...
2016 DK .... x7.... ....y7....
x_i and y_i are the yld_spread and inf_exp (arranged in two separate columns) of that country and the particular year and i = 2010, ...., 2016.
The code I have used is:
putexcel A1=("year") B1=("Country") C1=("yld_spread") D1=("inf_exp")
local row=2
foreach num of numlist 2010/2016 {
putexcel A`row'=("`num'")
putexcel B`row'=(country)
putexcel C`row'=(yld_spread) if year==`num'
putexcel D`row'=(inf_exp) if year==`num'
local ++row
}
But Stata is giving an error. Can someone point out to my mistake and help me write the right code?
Thanks,
Amit
Comment