Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suspected bug in -confirm-

    The title is self-explanatory. Here is a reproducible example:

    Code:
    clear
    sysuse auto
    confirm variable , exact
    There is no error where I think there should be one.

    I think the above should be equivalent to

    Code:
    clear
    sysuse auto
    confirm variable
    but it is not.

    In case you are wondering, this is relevant in situations where you pass to confirm a local macro that might contain a variable name (or a variable list) but might also be empty. Something like

    Code:
    confirm `could_be_a_varname_or_empty' , exact
    I am (still) using Stata 16.1 fully updated on Windows 11.


    Edit:

    Here is my workaround that I would like to share:

    Code:
    novarabbrev confirm variable ...
    Last edited by daniel klein; 27 Dec 2021, 04:44.

  • #2
    I can reproduce the example with fully-updated Stata 17 and I agree with Daniel that the expected behavior would be an error message when no variable name is specified, irrespective of whether the option exact is specified or not.
    https://www.kripfganz.de/stata/

    Comment


    • #3
      Agree with #1 and #2 above, and - my interest aroused by the odd wording of the error message - point out that neither the option exact nor the existence of any data in memory is needed - just the comma that would precede any option.
      Code:
      . clear all
      
      . confirm v
      '' found where varname expected
      r(7);
      
      . confirm v ,
      
      .
      If this isn't considered a bug, and can't be explained as a feature, correcting it as an inconsistency is a good candidate for the Stata 18 wish list.

      Comment

      Working...
      X