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

  • Having problem with Executing a certain line of a Do file

    Hi everyone,

    I do not know what is wrong with my Stata. When I select a certain line to execute in a Do file, Stata starts executing from the upper line of the code. For example, suppose I have the below two lines of code in my Do file:

    collapse (max) size density closeness_ego bridge2 bridge1 , by(id wave)
    destring id, replace

    When I select the second line and use execute button on the up right corner of Do file, it start executing from the collapse command.
    However, usually if I just copy paste the command to another blank Do file or in the command window, it works properly.

    Please let me know what might be wrong with my Do file.

  • #2
    Welcome to Statalist.

    Are you certain, when you select the line to execute, that you select it in exactly the same way you would select it to copy it?

    In my Stata, if I click within a line in the do-file editor, it is highlighted in yellow. But if I then use the execute button, it will execute the entire contents of the do-file editor window.

    If I want to copy a line, I click on the line number in the left margin of the do-file editor, and it is highlighted in blue. If I then use the execute button, only the blue-highlighted line is executed.


    • #3
      Yes. I am sure.

      Even if that was the case, it should execute the entire Do-file but it just executes the upper line.