Announcement

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

  • Running part of a do file through the command line in linux

    Hi,

    I'm wondering whether it is possible to run part of a do file through the command line in linux. Using the GUI I would just select the part I want to run and do Ctrl+D. I have no idea if it is possible to do something like this through the command line. A simple example would be to try a new specification of a regression without having to run the whole do file.

    Thanks.

  • #2
    Well, Appendix B.3 of Getting Started with Stata for UNIX tells us

    You may also use redirection, but this is not recommended:

    % stata < bigjob.do > bigjob.log &
    This suggests that something like
    Code:
    sed -ne "5,10p" bigjob.do | stata > bigjob.log
    might do the trick if you wanted to run lines 5-10 of bigjob.do. Change the sed command to whatever works best for selecting the lines you want; no need to actually count the input lines. Or substitute awk, or perl, or in the other direction, a combination of head and tail, or ... .

    I don't use Stata from the command line, so I haven't tested this beyond confirming that the sed command functions as I remembered.

    Comment


    • #3
      Thanks William, I'll try this approach.

      Comment

      Working...
      X