The trick is to write do file and use command line.
- Use VBA to write STATA do file. Example:
fnum = FreeFile() Open "\Path\to\Dofile.do" For Output As fnum Print #fnum, "reg income educ" Close #fnum - Use VBA to run do file. Actually it’s VBA asking command line to ask STATA to do the do file.
Shell("\Path\to\wsestata.exe do \Path\to\Dofile.do")












































