Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Loop through to Import Multiple Excel Files


From   daniel klein <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Loop through to Import Multiple Excel Files
Date   Wed, 3 Apr 2013 10:01:42 +0200

Lisa,

see -xls2dta- from the SSC for a canned solution.

Best
Daniel

--

Hi all (again),

I want to import multiple Excel files into STATA and then save these
as .dta files as an automatic process. This is my code so far:

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 mylist, replace

}

STATA can't seem to recognise this, which I don't really understand
either. Is it because I might have too many quotation marks or is the
setup incorrect?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index