Skip to content
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

invalid observation number #14

Closed
economoser opened this issue Sep 12, 2017 · 1 comment
Closed

invalid observation number #14

economoser opened this issue Sep 12, 2017 · 1 comment
Assignees
Labels

Comments

@economoser
Copy link

economoser commented Sep 12, 2017

When trying to use the -gcollapse- command I came across the following error repeatedly: the program would fail in the middle of execution, citing the following error:

'1.149e+08' invalid observation number

I attach the relevant part of the trace output from Stata below. Note that "1.149e+08" is the number of observations in my dataset, but I suspect that somehow this gets passed in the wrong format, causing this error:

    ----------------------------------------------------------------------------------- end gcollapse.gtools_timer ---
    - }
    - }
    - if ( "`merge'" == "" ) {
    = if ( "" == "" ) {
    - qui {
    - if ( `=scalar(__gtools_J) > 0' ) keep in 1 / `:di scalar(__gtools_J)'
    = if ( 1 ) keep in 1 / 1.149e+08
'1.149e+08' invalid observation number
      else if ( `=scalar(__gtools_J) == 0' ) drop if 1
      else if ( `=scalar(__gtools_J) < 0' ) {
      di as err "The plugin returned a negative number of groups."
      di as err `"This is a bug. Please report to {browse "`website_url'":`website_disp'}"'
      }
      ds *
      }
      if ( `=_N' == 0 ) di as txt "(no observations)"
      local memvars `r(varlist)'
      local keepvars `by' `gtools_targets'
      local dropme `:list memvars - keepvars'
      if ( "`dropme'" != "" ) mata: st_dropvar((`:di subinstr(`""`dropme'""', " ", `"", ""', .)'))
      if ( (`=_N > 0') & (`=scalar(__gtools_k_extra)' > 0) & ( `used_io' | ("`forceio'" == "forceio") ) ) {
      qui mata: st_addvar(__gtools_addtypes, __gtools_addvars, 1)
      gtools_timer info 97 `"Added extra targets after collapse"', prints(`benchmark')
      local __gtools_iovars: list gtools_targets - gtools_uniq_vars
      mata: __gtools_iovars = (`:di subinstr(`""`__gtools_iovars'""', " ", `"", ""', .)')
      if ( `debug_io_read_method' == 0 ) {
      cap `noi' `plugin_call' `__gtools_iovars', collapse read `"`__gtools_file'"'
      if ( _rc != 0 ) exit _rc
      }
      else {
      local nrow = `=scalar(__gtools_J)'
      local ncol = `=scalar(__gtools_k_extra)'
      mata: __gtools_data = gtools_get_collapsed (`"`__gtools_file'"', `nrow', `ncol')
      mata: st_store(., __gtools_iovars, __gtools_data)
      }
      gtools_timer info 97 `"Read extra targets from disk"', prints(`benchmark')
      }
      local order = 0
      qui ds *
      local varorder `r(varlist)'
      local varsort `by' `gtools_targets'
      foreach varo in `varorder' {
      gettoken svar varsort: varsort
      if ("`varo'" != "`vars'") local order = 1
      }
      if ( `order' ) order `by' `gtools_targets'
      forvalues k = 1 / `:list sizeof gtools_targets' {
      mata: st_varlabel("`:word `k' of `gtools_targets''", __gtools_labels[`k'])
      }
      if ( "`unsorted'" == "" ) sort `by'
      }
    -------------------------------------------------------------------------------------------------- end gcollapse ---
r(198); t=103.95 11:28:02

end of do-file
r(198); t=7348.34 11:28:02
r(198); t=7348.34 11:28:02

end of do-file
r(198); t=0.00 11:28:02
@mcaceresb
Copy link
Owner

This should be fixed. Let me know.

@mcaceresb mcaceresb self-assigned this Sep 12, 2017
@mcaceresb mcaceresb added the bug label Sep 12, 2017
mcaceresb added a commit that referenced this issue Sep 13, 2017
gtools-0.6.16 (2017-09-13)

* Improves the issues raised by #7
  Now the commands only fail if Stata hits the `matsize` limit (internally,
  the plugin no longer uses the `subinstr` hack to go from locals to mata
  string matrices and uses `tokens` instead, which is more appropriate;
  further, the plugin tries to set matsize to at least the number of variables
  and gives a verbose error if it fails).
* No longer crashes on Linux systems with older glibc versions.
* Fixes #14
* Should fix #12
* Fixes #9
* Fixed #8
  `gegen` is callable via `by:`; it also gives the stat for the
  overall group if called without a `by`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants