Suppose I write the following code in python:
But this obviously does not work as the %stata command is designed to be a one-line. What is the workaround here?
(The example is just intended to be an MWE. The actual code (in python) is more than a thousand lines and should be able to run with one click and no more interaction.)
Code:
%loading pystata as usual import stata_setup stata_setup.config("C:/Program Files/Stata17", "mp") from pystata import stata from sfi import Macro for ii in [1,2]: Macro.setLocal('kk', str(ii)) %stata forvalues jj=1/`kk' { %stata disp `jj' %stata }
(The example is just intended to be an MWE. The actual code (in python) is more than a thousand lines and should be able to run with one click and no more interaction.)
Comment