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 on April 23, and its replacement, statalist.org is already up and running.


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

[no subject]



This should work too:

foreach x in AB RB PC LS GO  {

Nick

On 3 April 2013 08:05, Lisa Wang <lhwang0925@gmail.com> wrote:

> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index