calling do-files error

calling do-files error

by Emily Tang -
Number of replies: 5

Hi, I'm having trouble opening the two do-files in the last part of the midterm, it seems like I can open only one at a time? I couldn't find the demonstration in the lecture but basically when I open one do-file, I cannot then open the other do-file.

Additionally, using quietly run was still giving me the data outputs from the called do-file, but I switched to the do command after the announcement. 

Any help would be appreciated, thanks!

In reply to Emily Tang

Re: calling do-files error

by Abigail Cortez -
I was definitely having the same issue! I eventually made the assumption that we could only run dataset at a time, so I ended up just doing...

quietly run "baseline_cleanup.do"
clear

quietly run "followup_cleanup.do"
clear

(Note, the quietly run also still gave me outputs from the called do-file...)

Not sure if you can actually run 2 data sets at the same time in STATA, but it kind of seems unlikely to me. I think the purpose of the question was to maybe be able to run both prior do files without any errors so that we wouldn't run into any issues when we merge them in the next steps of Part 3. Please correct me if I'm wrong!

Thanks!
In reply to Abigail Cortez

Re: calling do-files error

by Alex Dinh -
I got to the same solution similarly by having this code at the beginning of all the do files:

capture log close // close any open log files
clear // clear STATA's memory

Then running the do files with:
do do\Midterm_Part_1.do
do do\Midterm_Part_2.do
In reply to Emily Tang

Re: calling do-files error

by Sarah Goldberg -
How do you know if the run command worked?

I did: run "do-files/MidtermAssignment_part 1" & "do-files/MidtermAssignment_part 2"

But I have no idea if you can use the & in this context, nor if what I did worked
In reply to Sarah Goldberg

Re: calling do-files error

by Amanda Irish -
I don't believe you can use "run" in that way - each file should have a separate line. Run also suppresses the output of the do-file so in order for your log file to document everything correctly, you should use "do" and have each file on a separate line preceded by the "do" command.