Announcement

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

  • How to insert linebreaks in notes

    Dear altruistic nerds,

    how may I insert (= save) linebreaks in notes [if not possible by any means: characteristics] to variables?
    Of course, the simple "///" doesn't do the trick.

    Some idea?
    Thx a lot
    Thank you for reading (and some reply)
    Using Stata 16.1
    Extractions (-dataex-) of the data I'm working with is impossible, sorry!

  • #2
    The following code, when run from a do-file in Stata 15.1, seems to embed a newline character into the note. How that is treated by Stata subsequently may not be well defined or consistent. In particular, when I select and copy the note from my Results window, the line break disappears in the Results window while the selection is highlighted but apparently remains in the copied text as it reappeared when I pasted it below. So I suspect this is Stata's way of telling you this is not a possibility that has been reliably coded for.
    Code:
    clear
    set obs 1
    generate x = 42
    note x: `= "line 1"+char(10)+"line 2"'
    notes
    Code:
    . notes
    
    x:
      1.  line 1
    line 2

    Comment


    • #3
      I'll just add that on Windows systems you would probably use char(13) rather than char(10). But it exhibits the same inconsistency William noted.

      Comment


      • #4
        Clyde's post suggests that the (frankly, it's a) hack I proposed in post #2 is not robust to giving the data to someone else, which is of course the usual reason for including notes and the like in your dataset.

        Comment


        • #5
          The notes command respects SMCL directives (see help smcl) so you can use those to add formatting to notes (including boldface, italics, URLs, etc). Here's a quick example:

          Code:
          sysuse auto, clear
          note: Sources:{break} ///
                  {space 2}{browse "http://www.consumerreports.org/":Consumer Reports}{break} ///
                  {it: (with permission)}
          
          notes
          and the listed notes:
          Code:
          . notes
          
          _dta:
            1.  from Consumer Reports with permission
            2.  Sources:
                  Consumer Reports
                (with permission)
          
          .

          Comment


          • #6
            exactly, the idea is release the data in a SUF. so they should look somewhat nice.
            Robert's code works entirely perfect (breaks, link, space, italic).
            thank you for all of your respones!
            Good fight, good night
            Thank you for reading (and some reply)
            Using Stata 16.1
            Extractions (-dataex-) of the data I'm working with is impossible, sorry!

            Comment

            Working...
            X