In summary, my problem could be solved if I could save a bunch of code to a macro, then stipulate when the code is run (after meeting criteria in if statements).
In my .do file, I am asking the user some questions about what regressions they want to run, using display _request(macroname), then I interpret their answer (which is either yes or no in most cases) and define another macro that appears in the regression code. I'm doing this because there are lots of different options of which regression to run, and this makes it easy to select which one to run. Now I want to automate a process which loops through all the different options, and I thought it would be nice to add in an extra question at the start asking whether the user also doesn't want to bother with answering questions, but to run the 64 combinations (the output of which will save to various appropriately named different Word documents).
So I have the code for the regressions that needs to be run, but it needs to either be run only once after asking 5 questions, or looped.
Can I save the code to a macro and then stipulate when the code should be run?
FYI, the code I'm talking about is this: https://pastebin.com/fLpDt19m
In my .do file, I am asking the user some questions about what regressions they want to run, using display _request(macroname), then I interpret their answer (which is either yes or no in most cases) and define another macro that appears in the regression code. I'm doing this because there are lots of different options of which regression to run, and this makes it easy to select which one to run. Now I want to automate a process which loops through all the different options, and I thought it would be nice to add in an extra question at the start asking whether the user also doesn't want to bother with answering questions, but to run the 64 combinations (the output of which will save to various appropriately named different Word documents).
So I have the code for the regressions that needs to be run, but it needs to either be run only once after asking 5 questions, or looped.
Can I save the code to a macro and then stipulate when the code should be run?
FYI, the code I'm talking about is this: https://pastebin.com/fLpDt19m
Comment