Announcement

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

  • Error message

    I put the following code in the do file
    use "\\mlap1234\SAS_Data\PXXB_SEB\SEB\PayforPerformanc e\Ph1_DataPrep\NESS\STATAFiles_new\ness_oldnewsdf_ intermed.dta", clear

    Stata14 give me error message: use is not a valid command name
    But I can't find anything wrong within this line.

  • #2
    Hello Sherry,

    You may just click on File - Open - and select the file, and see whether there is some mistyping.

    Also, you may select STATAFiles_new as the working directory and just type: . use ness_oldnewsdf_intermed


    Hope that helps!

    Best,

    Marcos

    P.S. note that "performance" in your command line seems to present a blank space as well...
    Best regards,

    Marcos

    Comment


    • #3
      I have, from time to time, encountered a similar problem myself, and not just with -use-, but with pretty much any Stata command.

      In my case there are some clear circumstances around it. It never happens when I actually type commands myself into the command line or do-file editor. However, sometimes when I copy/paste code from my browser (Chrome) window, this occurs. It has happened when I have copied code from this forum. In each case, if I delete the offending line and simply re-type the same code by hand, the problem disappears. (If I re-copy/paste the code, the problem persists.)

      I do not actually know what causes it, but given that it only happens when I paste code from a browser window, I imagine that there are non-displaying characters embedded in the copied code that are "visible" to Stata and cause it to complain that the command is unrecognized.

      I do not know if this is a Stata bug, a Windows bug, a Chrome bug, or a bug in certain websites. It can be very frustrating, as it sometimes will occur several times in a single block of copy/pasted code.

      Comment


      • #4
        I know this is an older post, but I came across it doing a web search for the same issue. Clyde, your suggestion was about non-displaying characters was exactly my issue. Thanks.

        Instead of retyping the lines of command, I copied and pasted them into word, and clicked on the "show/hide" button in the "paragraph" section on the "home ribbon." (Described in "Method 1" here: https://www.datanumen.com/blogs/4-ea...word-document/.) This allowed me to see the problematic characters and delete them.

        Thanks for all of your help.

        Kind regards,
        Ben

        Comment

        Working...
        X