Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Loop through to Import Multiple Excel Files


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Loop through to Import Multiple Excel Files
Date   Wed, 3 Apr 2013 08:56:33 +0100

For "STATA" read "Stata". Please do read the FAQ before posting, as requested.

More importantly, the FAQ advises you to say _exactly_ what Stata
typed in response.

I suggest as code

local mylist  AB RB PC LS GO

foreach x of local mylist {

import excel C:\Users\Admin\Documents\Teaching\Marks_`x'.xlsx,
sheet("TI") firstrow clear

save `x', replace

}



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index