Announcement

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

  • transferring the results of my do file in a log file

    Hello! i have been having issues with converting do file into log file with new Stata 15. I am doing it the same way I was doing with previous versions, but somehow there seems to be an issue with the new release. I am able to run the commands one by one, but not for the entire do file. Is there a particular way to write the commands that I missed? I am average user and I am using Stata for econometric classes.
    Please let me know if someone can help. Thanks!

  • #2
    As far as I know, nothing about logging has changed in version 15. Anything between
    Code:
    log using my_log_filename, replace
    and
    Code:
    log close
    will be put in the log file.

    Can you show an example of a short do-file that you tried to run but were unable to get results into the log file?

    Comment


    • #3
      Hello Clyde, I would really appreciate your help, as I have an exam on Wednesday and will need to submit my do file and log file (with the results). I changed the first code "log using my_log_filename, replace" as I had something else before. I think it helped a little bit, but it still doesn't show all the results. I am attaching my do file and log file, so you can take a look. Thanks a million. Souad.
      Attached Files

      Comment


      • #4
        So, at line 77 in the do-file you have:

        Code:
        ****(vi)/////
        probit favwin spread favhome fav25 und25
        In modern Stata, when you have /// in a command, everything on the same line after that is taken to be a comment, and everything on the next line is interpreted as a continuation of the command preceding ///. But in this case, the "command" preceding your series of / characters is ****(vi), which is itself a comment. So your -probit- command is effectively commented out. Fix this by eliminating the series of slashes at the end of ****(vi)/////.

        Then, on line 80 in the do-file you have:
        Code:
        /* When favhome, fav25, and und25 are added to the probit model, the value of
        /* is used to open a long comment. Everything that follows it is part of the comment until you get to */. But your next "command" -test favhome fav25 und25- comes before you ever reach that point, so it, too, is commented out. Fix that by putting a */ at the end of line 82 or on line 83.

        As far as I can see, these are the only commands in your do-file that do not have output showing in the log file. If there are others, I suspect that they are, similarly, trapped inside a comment and can be rescued by appropriate changes to the commenting.

        By the way, if you are using a modern version of Stata, when you open the do-file in the do-editor, comments are automatically shown in green, whereas commands that are active are shown in black. If your eyes are capable of that color distinction, that is an easy way to spot these problems: if it's a command but it's in green, then your comment is not properly terminated. If you have a form of color-blindness that does not enable you to discriminate green from black, you can open the do-file editor, and on the Edit menu select Preferences and then go to the Color tab, where you can change the colors of all the various things displayed in the editor to colors that you are able to distinguish visually.


        Comment


        • #5
          Hello Clyde,
          Thanks a lot. I will pay attention to the slashes and stars, as I agree these might be the problem. For the colors, I do make sure that the commands are in black and that the comments are green. In fact, I was adding more slashes, as it was the only way for the commands to turn black. I was able to sit with someone this afternoon and we found a way to save log files differently, so at least it gives me the results of the commands.

          Thanks again for your help! I will write a do file tomorrow following what you recommended for the slashes and stars and will let you know if I have other questions.

          Comment

          Working...
          X