Announcement

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

  • use of stata on linux terminal

    Dear all,

    when I run my script on the Stata GUI command line "do code.do" everything is fine. Yet when I use a linux terminal and call "stata -b do code" I get the following error message: "command eststo is unrecognized".

    Any help to solve this issue is appreciated. Thanks!

    Regards,
    Michael

  • #2
    Hi,

    I have looked into this issue a little further: The crucial difference between the Stata GUI and Stata on the command line is that the former seem to be able to cope with files mounted via sshfs while the latter is not. More specifically, the package eststo is located locally in ~/bin, as recognised by sysdir, while the do file is located in a mounted filesystem. The Stata GUI compiles the do file without problem, yet the Stata command line complains that it does not find the eststo package.

    Has anyone come across a similar issue before?

    Thanks,
    Michael

    Comment


    • #3
      Check the shell's $PATH between the GUI and your terminal instance of Stata. You can do this using:
      Code:
      shell echo \$PATH
      In regards to the terminal, you're executing a Stata do-file using "batch mode." You should also be able to use Stata interactively (as in the GUI app) by entering stata at the command line. If that works, check the sysdir there.

      Comment


      • #4
        Thanks for the hints regarding interactive and batch mode of Stata, Matthew! The problem does not lie with the mounted file system. Instead, you were right in suspecting that the paths were not set correctly:
        1. When I type
          Code:
           stata
          in the Linux terminal, interactive Stata indeed opens. It turns out that in this instance, as well as when using the Stata GUI, my
          Code:
          profile.do
          is executed, setting my
          Code:
          sysdir
          in which the package is located.
        2. When I instead run the batch command
          Code:
          stata do code.do
          in the Linux terminal, my
          Code:
          profile.do
          does not seem to be executed so the package is apparently not found.
        What I am hence wondering is how one controls the location in which packages are installed. In particular,
        1. running
          Code:
          ssc install estout, replace
          from within interactive Stata (started as an ordinary user), is the package automatically placed in the personal directory listed in
          Code:
          sysdir
          ?
        2. With which Stata command does one check where an installed package is located?
        3. I reckoned that installing a package on Linux as root should solve the entire issue when packages are placed in one of the first three system directories listed here:
          Code:
          sysdir
          	   STATA:  /usr/share/stata17/
          	    BASE:  /usr/share/stata17/ado/base/
          	    SITE:  /usr/share/ado/
          	    PLUS:  ~/bin/stata17/ado/plus/
          	PERSONAL:  ~/bin/stata17/ado/personal/
          	OLDPLACE:  ~/bin/stata17/ado/
          Yet starting interactive Stata as root, it tries to place the package in its own PLUS directory:
          Code:
          ssc install estout, replace
          	checking estout consistency and verifying not already installed...
          	cannot write in directory /root/bin/stata17/ado/plus/_
          	r(603);
          This directory does not exist. Moreover, it is nonsensical to place the package in that directory as it would not be found by Stata started by ordinary users. So how does one install a package systemwide, for all users?
        I would be grateful for a pointer on how to solve these issues. Thanks!

        Comment


        • #5
          Try using which estout, all and sysdir and adopath across each instance. You can use sysdir set {STATA | BASE | SITE | PLUS | PERSONAL | OLDPLACE} "/path/to/directory" to set the system directories. I'm assuming your profile.do contains a line that sets a system directory, and because it is not being run in batch mode, Stata can't find the package.

          Comment

          Working...
          X