Announcement

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

  • new table command cannot parse bracket within string variable

    Is this the correct place to report an apparent error in parsing?
    this is Stata/SE 17.0 for Windows (64-bit x86-64). Revision 05 Oct 2021
    For my own reasons, I created a string variable that includes brackets. While the tab command can parse and present a table with this string variable, the table command cannot. I uploaded sample data and the do file. I tried to upload the log file as well but got an error message. Pasting the relevant part of the log file here. I also tested with a string variable whose values do not begin with the bracket but have the bracketed text appended to the end. Got the same error message.
    . clear

    . use sample_data_bracket.dta

    . tab bigstring

    bigstring | Freq. Percent Cum.
    ------------+-----------------------------------
    [1 big] | 22 25.29 25.29
    [2 big] | 37 42.53 67.82
    [4 big] | 24 27.59 95.40
    [6 big] | 4 4.60 100.00
    ------------+-----------------------------------
    Total | 87 100.00

    . table (bigstring)
    invalid tag;
    open bracket '[' not found
    r(198);

    end of do-file
    I hope I included the necessary information.
    I have a work-around available that will use another character to delimit the "big" notation in the string.
    Attached Files

  • #2
    Is this the correct place to report an apparent error in parsing?
    I've reproduced your program and agree that there is no hint in the documentation that certain values for string variables might cause a syntax error in the table code. And it does not occur under version control to Stata 16.
    Code:
     tab y
    
              y |      Freq.     Percent        Cum.
    ------------+-----------------------------------
          [cat] |          1       33.33       33.33
          [dog] |          1       33.33       66.67
       [rabbit] |          1       33.33      100.00
    ------------+-----------------------------------
          Total |          3      100.00
    
    . table (y)
    invalid tag;
    open bracket '[' not found
    r(198);
    
    . version 16: table (y)
    
    ----------------------
            y |      Freq.
    ----------+-----------
        [cat] |          1
        [dog] |          1
     [rabbit] |          1
    ----------------------
    
    .
    I encourage you to report this problem to Stata Technical Services, see

    https://www.stata.com/support/tech-support/

    for details.

    Comment


    • #3
      Thank you. Wasn't sure how to report.

      Comment

      Working...
      X