Announcement

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

  • Order command error Stata 15

    Trying to simply alphabetize variables in a dataset. Previously used aorder; which has been replaced by order, alphabetic. But I keep getting the error posted below. Any ideas where I'm going wrong.

    . order _all, alphabetic
    using not allowed
    r(101);

  • #2
    It works for me with Stata/IC 15.0 on Windows 10 (64-bit)

    Code:
    sysuse auto, clear
    order _all, alphabetic
    Red Owl

    Comment


    • #3
      Also works for me, Stata/MP2 15.0 on Windows 7 (64-bit).

      One thought: is there a variable named using in the data set? If so, I suspect you would get precisely the error you are seeing as the parser would think that you are trying to stick a -using- clause into the -order- command (which takes only a varlist). -using- is a reserved word in Stata and is not a legal variable name.

      I tried to create a data set with such a variable to see if I could produce this error. But Stata seems to catch me trying to create an illegal variable name like that, so I have not succeeded. If you indeed have such a data set, I'd be curious how it was created, as Stata has blocked me on every path I've tried.

      Comment


      • #4
        I note that
        Code:
        sysuse auto, clear
        aorder _all
        continues to function in my copy of Stata 15, so that's a possible workaround.

        You wouldn't perhaps have a dataset that somehow contains a variable named "using", would you? I'm reasonably sure that will create this problem (having looked behind the scenes at order.ado), If you have such a dataset, can you share with us how the using variable was created, because the obvious ways (generate, input, import excel, rename) won't make it happen for me.

        Added in edit: Great minds think alike.

        Comment


        • #5
          Thanks for the responses. The dataset I'm using was shared with me by a colleague. Turns out there is in fact a variable named "using" which is the source of the problem. Great catch. As to how the variable got into stata: I received the original file as an SPSS file and converted it to stata. I'm guessing that's how this "illegal" variable name worked it's way in.

          Comment

          Working...
          X