Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loops to switch between different sub-folders

    What is wrong with commands in this Stata do-file? I am trying to open all batch files that are in separate sub-folders named Batch1-Batch2-..... to Batch32. These subfolders are in Output folder.
    Also is there any way to append them using loops in Stata rather than doing one by one?



    clear all
    gl outputs "E:\Outputs"

    forvalues i = 1/32 {
    import delimited "$outputs/Batch`i'/batchfile.tab", clear
    tempfile batchfile_`i'
    save `batchfile_`i''
    }

  • #2
    What is wrong with commands in this Stata do-file?
    Why do you think something is wrong? Your code looks fine to me.

    Your question really isn't clear without more detail, or at a minimum it is too difficult to guess at a good answer from what you have shared. Please help us help you. Show us what Stata told you. It's particularly helpful to copy your commands and the output from your Stata Results window and paste them into your Statalist post using code delimiters [CODE] and [/CODE]. The Statalist FAQ provides advice on effectively posing your questions, posting data, and sharing Stata output.

    Comment

    Working...
    X