Hello,
I could not find an earlier post on Statalist regarding this, but please let me know if I overlooked it.
After upgrading to Stata 15, I am much more frequently getting the error, "unexpected end of do-file" and cannot figure out why. The code seems completely innocuous. What's more, it is difficult to reproduce.
Here is a snippet that stopped my do-file running overnight, a bit frustrating when a long file is interrupted. The code is not part of a loop, if, or any other structure that could be missing a "}". The error comes despite that fact that the next command is merely to store the estimates posted by margins (see second code set below). The do-file had been running for about 20 minutes before this error-- so there are several earlier estimations and some take a while to run, etc.
Error running entire do-file:
No error, selecting snippet and running:
But, I want to emphasize, it is as far as I can tell NOT always related to -margins- or this series of steps-- it doesn't seem specific to -margins- or -est store-, or the particular estimation completed prior to the -margins- (in this case using -ml-). I can't rule any of these out as factors, but seeing the error over and over and looking for patterns I haven't noticed that. It happens with other commands. Moreover if I select and run the snippet, as shown above, it runs fine.
I thought for a while that it had to do with the CR and LF at the end of the lines, but these appear intact (when viewing in the editor). Sometimes I would add extra CR/LF and re-run and the do-file would work, but I think now this is a coincidence.
Mostly I am wondering if others are seeing this issue. As I cannot give exact conditions for generating the error, nor can I reproduce it reliably, it is difficult to debug. But I do see it with increased frequency recently, perhaps related to Stata 15.
That I see it somewhat "randomly" and usually when I am running a do-file that takes a relatively long time suggests to me perhaps it has something to do less with Stata execution, and more perhaps with the file system that is reading the do-file as execution proceeds...? Perhaps a temp file is disappearing over a long run? I am running Stata in a complex network environment, on a remote server, in a large bureaucracy so I have limited control over the implementation details, and all that is beyond my knowledge. But I could ask around/check stuff if I had specific ideas where to look.
Here is what the "About Stata" panel says:
Stata/MP 15.0 for Windows (64-bit x86-64)
Revision 20 Jul 2017
Available physical memory: 234785112 KB
Available Physical Memory: 187918540 KB
10-user 4-core Stata network perpetual license:...
Thanks for any clues,
Scott
I could not find an earlier post on Statalist regarding this, but please let me know if I overlooked it.
After upgrading to Stata 15, I am much more frequently getting the error, "unexpected end of do-file" and cannot figure out why. The code seems completely innocuous. What's more, it is difficult to reproduce.
Here is a snippet that stopped my do-file running overnight, a bit frustrating when a long file is interrupted. The code is not part of a loop, if, or any other structure that could be missing a "}". The error comes despite that fact that the next command is merely to store the estimates posted by margins (see second code set below). The do-file had been running for about 20 minutes before this error-- so there are several earlier estimations and some take a while to run, etc.
Error running entire do-file:
Code:
. est restore cms_hurd_ml (results cms_hurd_ml are active now) . margins, dydx(i.mhr) post expression( invlogit(predict(equation(first)))) vce(delta) Average marginal effects Number of obs = 324,020 Model VCE : Robust Expression : invlogit(predict(equation(first))) dy/dx w.r.t. : 1.mhr ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.mhr | -.0124177 .0135112 -0.92 0.358 -.0388993 .0140639 ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. . unexpected end of do-file end of do-file
Code:
do "C:\Users\VH8ADB~1\AppData\Local\Temp\26\STD1274_000000.tmp" . est restore cms_hurd_ml (results cms_hurd_ml are active now) . margins, dydx(i.mhr) post expression( invlogit(predict(equation(first)))) vce(delta) Average marginal effects Number of obs = 324,020 Model VCE : Robust Expression : invlogit(predict(equation(first))) dy/dx w.r.t. : 1.mhr ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.mhr | -.0124177 .0135112 -0.92 0.358 -.0388993 .0140639 ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. . est store cms_hurd_m1_ml . . end of do-file
I thought for a while that it had to do with the CR and LF at the end of the lines, but these appear intact (when viewing in the editor). Sometimes I would add extra CR/LF and re-run and the do-file would work, but I think now this is a coincidence.
Mostly I am wondering if others are seeing this issue. As I cannot give exact conditions for generating the error, nor can I reproduce it reliably, it is difficult to debug. But I do see it with increased frequency recently, perhaps related to Stata 15.
That I see it somewhat "randomly" and usually when I am running a do-file that takes a relatively long time suggests to me perhaps it has something to do less with Stata execution, and more perhaps with the file system that is reading the do-file as execution proceeds...? Perhaps a temp file is disappearing over a long run? I am running Stata in a complex network environment, on a remote server, in a large bureaucracy so I have limited control over the implementation details, and all that is beyond my knowledge. But I could ask around/check stuff if I had specific ideas where to look.
Here is what the "About Stata" panel says:
Stata/MP 15.0 for Windows (64-bit x86-64)
Revision 20 Jul 2017
Available physical memory: 234785112 KB
Available Physical Memory: 187918540 KB
10-user 4-core Stata network perpetual license:...
Thanks for any clues,
Scott
Comment