Announcement

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

  • Comments log file inside foreach

    Dear all,

    I am running this code, which creates different log files for each "Centro", each one tabulating some tables.

    Everything works well except for the comments I need to put in between (starts with *). Does anybody know why they do NOT appear in the log file? The lines on the commands do not appear either but I don't mind about them

    Thank you in advance.

    Joan


    -----

    foreach centro in 35 36 38 {
    preserve
    keep if var21==`centro'
    log using "xxxxxxxxxxxxx\\`centro'.log", replace
    * Comment on this line
    di NombreCentro
    foreach y of global tablas {
    tab `y' , sort
    }
    log close
    }

    -------


  • #2
    Think of it this way. Many programs contain comments, but when you run those programs do you ever see the comments?

    To get a display of text, use display of text.

    Comment


    • #3
      Hi Nick, thanks for helping but I still can't manage. Where should I use display?

      Comment


      • #4
        Code:
        di "* Comment on this line" 

        Comment


        • #5
          Thanks Nick. And do you know how NOT to display the commands, as in programs, in a normal log file, and only display lines like this?
          di "* Comment on this line"






          Comment


          • #6
            I don't see the question here. If you don't want to see a line, don't display it?

            Comment


            • #7
              In the case it is not a program, like a normal log file, the commands are displayed by default

              Comment


              • #8
                Do you know about run ?

                Comment


                • #9
                  I didn't so just tried. Run executes without displaying neither the commands nor the results. I am wrong? I want to see only the results and anything I write in dith di ".....", as if it was inside a program, as you just explained in #2 . I don't know if I am clear

                  Comment


                  • #10
                    look at the help file for quietly and noisily (e.g., "h noisily") and then put "noi" in front of lines you want to see the results of

                    Comment


                    • #11
                      This would not display the results: what I want to avoid is the commands.

                      I want to see the results in the log file without the commands, as if it was a program (#2)

                      Comment


                      • #12
                        See http://www.stata.com/statalist/archi.../msg00105.html.

                        Comment

                        Working...
                        X