I am importing 12 files from excel. These worksheets have common name starting from II1 to II12. However, my code doesn't work.
Can someone please tell me where m I going wrong?
foreach i =1/12 {
2. import excel "C:\Users\rk0022\Dropbox\\II.xls", sheet("II`i'") firstrow clear case(lower)
3. reshape long y_, i(country) j(year)
4. rename y II`i
5. save ""C:\Users\rk0022\Dropbox\II`i'.dta", replace
6. }
2. import excel "C:\Users\rk0022\Dropbox\\II.xls", sheet("II`i'") firstrow clear case(lower)
3. reshape long y_, i(country) j(year)
4. rename y II`i
5. save ""C:\Users\rk0022\Dropbox\II`i'.dta", replace
6. }
Ritika
0 Response to Looping and importing excel sheets
Post a Comment