Announcement

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

  • Error with strgroup command: “<66230698 invalid name r(198)” — help needed

    Hello family

    I'm working with a large panel dataset on trade (30 variables, and over 66.23 million observations) and trying to group similar string entries using the strgroup command in Stata 17. Specifically, I want to cluster variations of company names that refer to the same entity (e.g., "Kernel Export Bio SL", "Kernel Export SL Bio", "Kernel Export SL"). Many entries refer to the same entity but are spelled differently.

    I attempted the following command:

    "strgroup versendername, gen(name_group) threshold(0.85)"

    But I received this error:

    "<66230698 invalid name
    r(198);
    "
    I’ve double-checked that versendername exists and is a string variable.

    Has anyone encountered this issue before?

    Any suggestions would be greatly appreciated!

  • #2
    -strgroup- is not an official Stata command. It is written by Julian Reif and is available from SSC.

    There is nothing obviously wrong with your use of the command. The help file for -strgroup- does indicate that data sets with large numbers of observations can be problematic both in terms of compute time and memory issues. It may be that the error message you are getting is not helpfully composed but stems from an underlying memory problem. That's just a guess on my part. Can you reproduce this problem using a subset of your data containing, say, < 1000 observations? Does the problem persist if you use the -first- option?

    Comment


    • #3
      I agree with all the remarks of Clyde Schechter

      In addition, a specific error message about an invalid name should arise when something is being offered as a name that is not acceptable as such to Stata. In Stata names must start with letters or underscores, so <66230698 fails because its first letter is neither.

      You (we) might get closer to a diagnosis with a code trace. Open a log file if you are not doing so already. Then

      Code:
      set trace on
      before you run that command --
      and show us the code just before the command fails. Two linked problems in producing traces are that

      1. You might need to bump up trace depth by say

      Code:
      set tracedepth 2
      (or 3 or 4 or ...) before you run the commend.

      2. The higher the trace depth, the longer the resulting trace, creating a long log to wade through.

      Comment


      • #4
        I don't see anything wrong with your code as written. The following example runs fine on my computer:

        Code:
        sysuse auto, clear
        strgroup make, gen(name_group) threshold(.85)
        I recommend reinstalling the command (ssc install strgroup, replace) and trying again. If that fails, you can try the helpful suggestions from Clyde Schechter and Nick Cox. If you still obtain errors, I recommend putting together a minimum working example and posting it on strgroup's Github site.
        Associate Professor of Finance and Economics
        University of Illinois
        www.julianreif.com

        Comment


        • #5
          in #3 for "first letter" read "first character"

          Comment


          • #6
            Clyde Schechter yes, the problem persisted when I used the -first- option. However, it worked when I used a subset of the data

            Comment


            • #7
              Click image for larger version

Name:	3.png
Views:	2
Size:	35.5 KB
ID:	1782077
              this is what I got when the _first_ option was included
              Attached Files

              Comment


              • #8
                But when I used the subset, I got results
                Click image for larger version

Name:	4.png
Views:	1
Size:	19.9 KB
ID:	1782079

                Comment


                • #9
                  Since it worked with smaller observation, I will proceed to do it bit by bit. Thank you all for your support.

                  Comment

                  Working...
                  X