Announcement

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

  • Ambiguous abbreviation/variable not found errors

    Hi,

    I'm using Stata 15.1 on a Mac. I have been cleaning a dataset with no problem for a few weeks and today I received the following error message:
    Code:
    tab q2_7
    q2_7 ambiguous abbreviation
    r(111);
    After reading some help files I tried:
    Code:
    set varabbrev off
    And got this error:
    Code:
    tab q2_7
    variable q2_7 not found
    r(111);
    However, if I type tab in the command field and click on the variable from the variable list, it works.

    This is the output when I type des and click on the variable (it also gives me an error if I just type it or try to run from a do file):
    Code:
    des q2_7 
    
                  storage   display    value
    variable name   type    format     label      variable label
    -----------------------------------------------------------------------------------------------
    q2_7            str123  %123s               * Q2.7
    I would appreciate any thoughts on what the problem might be. Please let me know if I need to provide more information.

  • #2
    Try

    Code:
    describe q2_7*

    Comment


    • #3
      If I do that I get:
      Code:
      des q2_7*
      
                    storage   display    value
      variable name   type    format     label      variable label
      -----------------------------------------------------------------------------------------------
      q2_7            str123  %123s               * Q2.7
      q2_7_other      str113  %113s               * Q2.7_9_TEXT
      q2_7_1          byte    %8.0g                 
      q2_7_2          byte    %8.0g                 
      q2_7_3          byte    %8.0g                 
      q2_7_4          byte    %8.0g                 
      q2_7_5          byte    %8.0g                 
      q2_7_6          byte    %8.0g                 
      q2_7_7          byte    %8.0g                 
      q2_7_8          byte    %8.0g                 
      q2_7_9          byte    %8.0g
      Is it a problem that the variables have similar names? This is the naming convention I've been using for sub-questions in survey data and haven't had any issues until today.

      Comment


      • #4
        I'm sorry, please disregard my question. It looks like I accidentally typed a space into the do file where I renamed the variable, so it was actually q2_7[space]. Leaving this post in case anyone else encounters the same problem, because I didn't know Stata recognized spaces in variable names.

        Comment

        Working...
        X