Announcement

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

  • Order a variable containing "_" not allowed

    I tried to reorder some variables in my dataset for better overview which worked fine in most cases. However when i tried

    Code:
     order b_d b_o b_s, after(b)
    (these are three different variables that sould be ordered after the var "b". Sorry for the bad readability)

    I got
    factor-variable and time-series operators not allowed
    . Since I am relatively new I assume that is not a bug, but rather a mistake on my side but I could not find any solution to this.
    Could you please explain my mistake and how to do this correctly? I guess it is due to my variable naming, and if so, is there another way to do it besides renaming them?

    Greetings,
    Tobias

  • #2
    I could not reproduce the issue in Stata 17.0 (Windows):

    Code:
    clear all
    version 17.0
    
    input b_d b_o b_s b
          1 2 3 4
    end
    
    order b_d b_o b_s, after(b)
    
    /* end of file */
    Code:
    . des
    
    Contains data
     Observations:             1                  
        Variables:             4                  
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Variable      Storage   Display    Value
        name         type    format    label      Variable label
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    b               float   %9.0g                 
    b_d             float   %9.0g                 
    b_o             float   %9.0g                 
    b_s             float   %9.0g                 
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sorted by: 
         Note: Dataset has changed since last saved.

    Please provide more details as the issue may be caused by some not-mentioned factor.

    Best, Sergiy

    Comment


    • #3
      I think you might have made a typo (either in what you show here as your -order- command, or what you typed at your keyboard into Stata). I cannot reproduce your problem in Stata 18.

      Code:
      clear
      set obs 1
      gen b_d=1
      gen b_o=2
      gen b_s=3
      gen b=0
      order b_d b_o b_s, after(b)
      desc
      Edit: Crossed with #2

      Comment


      • #4
        Thanks for your help!

        I just tried byreloading the data set and for some reason it worked just fine. I have no idea what I did wrong...

        What I can provide:
        I use Stata 15.1 (windows)
        b_d b_o b_s are all floats and b is a double.

        sorry for wasting your time and once again, thank you! (should I delete the post since its probably just due to my machine/incompetence/some random error?)

        Comment


        • #5
          No need to apologise, but you cannot delete the post. See 16.2 at https://www.statalist.org/forums/help#closure

          Your caution about shouting "Bug!" is appreciated. If it was a bug, seemingly it has been fixed.

          Comment


          • #6
            I see. Thank you for your claification!
            I assume that Leonardo Guizzetti was probably right in that it was just a typo from my side, as I could "reproduce" the failure by trying the command withouth the "," sperating options() from variable input.

            Comment

            Working...
            X