Announcement

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

  • force stata to recognize command when working interactively

    Hi everyone,

    The * symbol at the beginning of a line tells stata to skip that line. The // symbol allows you to add a comment after a line of code, that will nevertheless be processed by Stata. Unfortunately one cannot use anything else than * interactively. I think this is really inconvenient. Running a code interactively can make a debugging process way smoother. if one wants his code to be useable interactively, one has to use * to comment, which adds tons of lines and is an ugly way to comment. Hence my question :

    Is there a way to force Stata to recognize, for example, //, as the same thing as * ?

    Thank you !

  • #2
    If you wish to add comments when you are working "interactively", you are already going beyond what I would of thought of as "interactive". Why not type your commands with comments into a blank do-file in the do-file editor, and run the lines from there?

    Comment


    • #3
      Thank you for your answer. Well the situation where I need this is the following (it occurs quite often) : I have to take someone's code and modify it for my purpose. Before modifying anything I need to understand exactly what it does, and given how it is written, the only way to do that is to run it step-by-step. But, it sometimes comments with // which makes the step-by-step run very inconvenient (i.e, impossible to run chunks of code, but forced to select with the mouse the part of the line to run...). I think your suggestion doesn't solve that issue?

      Comment


      • #4
        There is no solution for your precise need unless StataCorp make a fundamental change to what is allowed, which I have to guess is unlikely. Indeed, I don't even agree that it's a good idea. Separating comments from code absolutely is an easy idea for beginners to grasp, in my experience, but allowing comments that can be clearly distinguished in scripts to be mixed with code in interactive statements might lead to more bugs.

        Running code line by line leads to very many of the questions here because local macros are then separated from their definitions.

        Turn and turn about, my general practice is have code and comments on separate lines even when mixing is allowed. I don't agree that that is ugly style.

        Comment


        • #5
          Thank for your Answer. I understand the point !

          Comment

          Working...
          X