-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using gegen and reg within program returns error 198 #40
Comments
I don't get this issue. Can you run clear all
sysuse auto , clear
cap prog drop pargegen
prog define pargegen, rclass
version 13
syntax varlist [if]
marksample touse
disp "`level', $_level"
gegen test = sum(price)
disp "`level', $_level"
reg `varlist' if `touse'
drop test
end
pargegen price weight foreign rep78 I don't think gtools ever sets a local called "level" but I could be wrong. |
I don't know if this is helpful, but I noted the strange behavior that after a run with |
As I noted, I couldn't reproduce the issue, which is why I was trying to figure out if clear all
log using test, text
sysuse auto , clear
cap prog drop pargegen
prog define pargegen, rclass
version 13
syntax varlist [if]
marksample touse
disp "`level', $_level"
cap noi gegen test = sum(price)
disp "`level', $_level"
exit `=_rc'
reg `varlist' if `touse'
drop test
end
pargegen price weight foreign rep78
log close _all And send the log file? You say you are using |
What is the OS where it gave the error? OSX? Win7? |
running on arch linux. This is the log file: |
I'm on arch as well, so I'm not sure what's failing. Can you run version
which gegen
which gtools ? |
. version . which gegen . which gtools The starting point of this issue was gvegayon/parallel#66 |
Thanks! I'll look over that issue thread and see if there's any clues there. I upgraded to parallel 0.19 and still no issue. Will keep you posted. |
I've tried it on 2 other Linux systems w/o error. It's really strange to me because we are using the same OS and gtools version anyway... Can you run: clear all
log using test, text
which reg
which regress
which _get_diopts
sysuse auto , clear
cap prog drop pargegen
prog define pargegen, rclass
version 13
syntax varlist [if]
marksample touse
egen test = sum(price)
reg `varlist' if `touse'
gegen test = sum(price), replace
reg `varlist' if `touse'
drop test
end
pargegen price weight foreign rep78
log close _all Sorry I'm basically going blind here, since I don't get the same issue you do. Hopefully we can find the root cause of the problem, though. |
Thanks for all your efforts. I noticed that I can reproduce the error even with this code:
log: test.log Removing all ados in PLUS and reinstalling only gtools didn't help either. Might want to try reinstalling Stata itself? |
Does this happen with other gtools commands or is it just |
|
Can I have the log for findfile gtools_unix.plugin
!ldd `r(fn)'
clear all
sysuse auto
global GTOOLS_CALLER gegen
_gtools_internal price, gfunction(hash) gen(test) debug(9) v bench(3)
_regress price weight ? I expect you will get the same error. Hopefully the log has a clue... |
here is the log: test.log |
log for clear all
sysuse auto
global GTOOLS_CALLER gegen
_gtools_internal price, gfunction(hash) gen(test)
set trace on
_get_diopts diopts options, ? |
This is very strange; there is nothing in the source file that suggests where level gets assigned to its default value of 95. It should be blank throughout... Could you edit _get_diopts.ado? findfile _get_diopts.ado
!cp `r(fn)' `r(fn)'.bak Could you add
to GetDiopts, before and after the first Then re-run the latest snippet. Thank you for all your help debugging. |
log: test.log |
Ok, I think this at least gives a clue, since
(keep the modifications to |
log: test.log |
Oh, wow, so it's not setting the default. It's actually appending ",0" to whatever you pass. That is exceedingly bizarre. Can you try: capture program drop test
program test
syntax, [level(cilevel)]
disp "`level'"
end
clear all
set obs 10
gen x = 1
test
gegen y = sum(x)
test |
Yeah, bizarre is probably the right description. Here the output:
|
Can you try that with the develop branch? local github "https://raw.githubusercontent.com"
net install gtools, from(`github'/mcaceresb/stata-gtools/develop/build/)
clear all
capture program drop test
program test
disp "`0'"
syntax, [foo(cilevel)]
disp "`foo'"
end
set obs 10
gen x = 1
test
gegen y = sum(x)
test Can you also try clear all
set obs 10
gen x = 1
syntax, [foo(cilevel)]
disp "`foo'"
gegen y = sum(x)
syntax, [foo(cilevel)]
disp "`foo'" |
same result after installing dev branch:
and for the second program
|
By the way, I was unsure if some local configurations caused the error. Therefore, I installed Stata MP 15.1 + gtools in a fresh Ubuntu 18.04 virtualbox environment. Too bad, I was able to reproduce the same error. |
Tried fresh 18.04 in virtualbox as well and no error for me. I have no clue what's up! I'm really sorry. Un_n
|
Can you try again? Gtools 1.0 just hit the develop branch. While it doesn't address this specifically, the plugin has changed enough that I'm hoping whatever internals were messing it up are not there anymore (on Stata 15 it should use a newer version of the plugin interface, for example; make sure you have version |
same same ...
|
Ok, that one is on me; really sorry. I had compiled that for Windows and I forgot you're also on Arch. I re-posted the files as a ZIP here. Can you try again? You can just do |
this is the output:
|
I was really hoping it was the plugin interface in general, but it seems to be something in gtools. Can you add
right before and right after line 2157 of _gtools_internal.ado (it would be in your adopath, for me The idea is to know whether it's something in the Sata code or the C code. |
here is the log file: log.log |
I've come across a similar (the same?) issue while using ppmlhdfe and gegen in the same do-file: using gegen before ppmlhdfe causes ppmlhdfe to fail with "invalid syntax" while using egen causes no such problem. This issue only occurs when using Stata on our linux cluster; the code with gegen worked without issues on my MacOS X laptop. (This causes no problems for me as I can simply use egen, but I thought it might be helpful to know that the issue might be Linux-specific. Although of course many other variables also differ between the cluster and my laptop...) |
If you run ppmlhdfe with the verbose(1) option, or if you run "set trace" beforehand, where in the program is it reporting an error? Ppmlhdfe doesn't use C plugins, so on principle it should be like any other programs |
Using verbose(1) does not change the output (it still just says "invalid syntax"). The output from set trace on is attached; I believe it fails in _get_diopts. (I don't think this is an issue with ppmlhdfe; rather I think ppmlhdfe in my example fails in the same way as reg fails above. The error is presumably in gegen, or even more low-level) |
For whatever reason it seems that there are corner cases where gegen causes the default cilevel to be set to It is very puzzling to me because I never set ci level in any gtools programs and I cannot reproduce the error (be it in my Linux laptop or the Linux servers I use). |
@ppoppitz @lmusolff If you still get this bug, can you try the develop branch? (gtools version 1.3.2; I just got a report that I suspect is related (#53). It occurs to me that maybe if I save the state of level before running the plugin and restore it after then maybe I can bypass the problem. |
sry, I still get the same errors with version |
@ppoppitz Can you try gtools version 1.3.3? |
I verified the code from #53 gives me the same error as there with gtools 1.1.2, but when I try to upgrade I get the following error:
|
Try local github "https://raw.githubusercontent.com"
net install gtools, from(`github'/mcaceresb/stata-gtools/develop/build/) If you get the same error, what happens if you run
You should see
Let me know if you don't. |
Here's the output from those commands:
|
That was a typo on my part, I meant In any case, maybe try this:
|
The former gives me r(1), but the second successfully upgraded to "version 1.3.3 15Feb2019". And now I can run the code from #53 without an error :) (I'll try my own at some point but I doubt it would differ, and it is part of a big job that I can't really isolate so need to schedule a run for) Thanks for looking into this! |
I think I'll ask Stata why that file can't be copied on some systems. You're not the first person to have this issue. Can you run
and let me know the error code, if any? |
Yes, I vaguely remember having trouble installing it the normal way back when I did because I think of the same error. From that command I get:
EDIT: I just ran the same command on my MacOsX Laptop and it gives me the same r(1). But maybe this should be a different issue; let me know if you'd like me to open one. |
Can you re-try? I want to know if this had anything to do with the fact it's a tiny file (14 bytes). I just modified the file to be a copy of |
Oh wow, apparently that did it: the copy command executes now without problem (both on my laptop and the server). My Stata version is 13.1. |
Ok, great. I'm just going to have my build file copy |
Of course, no worries! Thanks for writing & maintaining this awesome package! |
Awesome, it's working here too. Thanks again for your efforts! |
To parallelize bootstraps with the ado
parallel
I have included gegen and regress in a small program which returns the invalid syntax error 198.When replacing
gegen
withegen
the programm runs fine.Setting trace on I get the following error log:
gtools_log.txt
My suspicion is that the local level, which is defined by regress, is somehow altered by gegen. According to the stata manual level(95) is the default option but in line 3883 of the log file
95,0
shows up. Even when I define the regress option, level(95)
explicitly, the same error is shown.The text was updated successfully, but these errors were encountered: