Announcement

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

  • Wrap lines in the Stata do file editor

    Dear Statalisters:

    I use Stata MP 13.1 for windows.

    With the Stata do file editor, long command lines exceed the screen width and I am trying to have these long lines wrapped over several lines.

    I found in a Stata manual that there is an option in the do file editor:

    Edit
    Advanced
    Wrap lines

    Unfortunately, I do not have this option in Edit/Advanced and I do not understand why.

    (A colleague of mine has the same version of Stata for Mac and has the wrap lines option).

    Best regards

    Hervé

  • #2
    I don't have that option either (also Windows), but I have never missed it. I tend to wrap my lines manually using ///, e.g.:

    Code:
    This is the first  line of long command ///
                second line of long command


    This allows me also manual control over indentation so I can make options or variables line up, which makes it easier for me to spot any errors.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Dear Maarten:

      I thank you for your reply that is very clear.

      I still would like to understand why I do not have the wrap lines option which is mentioned in the Stata manual and which exists for my colleague with Mac.

      Best regards

      Hervé

      Comment


      • #4
        This is for StataCorp, but small details in the interface do sometimes vary with platform (Windows, Mac, other Unix) even in the same release. The predictors include

        1. How easy it is implement something on a given platform.

        2. Caprice of the developers.

        Comment


        • #5
          Hi,

          Did statacorp make any progress on this? I think it would be useful to have this option now (instead of using the ///), especially because the dofile does it automatically when the line is too long. But still I can't find a way to manually wrap a long coding line.

          Thanks for your updates

          Comment


          • #6
            Yes, since at least version 16 (which is as far back as I have on my machine), there is an option to toggle line wrapping.

            Apparently, it is also on by default as I seem to have it enabled. However, I have never once used this feature because it is unreasonable to me to write excessively long lines of code on a single, wrapping line, where I can easily miss code when scrolling or make errors less obvious. I have always used the /// operator to force continuation of code over multiple lines which keeps all of my code within a reasonable and tidy line size. This also means that if I made my do-file editor fit over just half of my screen, then it doesn't have to reflow my code.
            Last edited by Leonardo Guizzetti; 01 Jul 2022, 18:15.

            Comment

            Working...
            X