Advanced topics
|
Title |
|
Advanced topics |
|
Author |
Chinh Nguyen, StataCorp |
|
Date |
November 2004
|
The following topics apply to the GUI version of Stata for the Macintosh.
Advanced starting of the console version of Stata for the Macintosh can be
found in the Getting Started with Stata for Macintosh manual.
Starting Stata from a shell
|
Warning:
The following section is recommended for advanced users only.
Administrator access and a good knowledge of Unix may be required. If
you are not comfortable editing resource files and do not fully
understand any of the instructions, it is highly recommended that you
do not attempt any of it because there is the potential to do damage
to your system.
|
The syntax of the command to start Stata from a shell such as from the
Terminal application is
Stata [-option [-option [...]]] [stata_command]
where the options are
|
-q |
suppress initialization messages |
|
-m |
amount of memory to allocate; default is -m1
for Intercooled Stata and -m10 for both Stata/SE and Stata/MP.
Not applicable to Small Stata. |
|
-b |
set background (batch) mode and log in ASCII text |
|
-e |
set background (batch) mode and log in ASCII text and
exit without prompting when Stata command is completed
|
|
-s |
set background (batch) mode and log in SMCL |
You must add the path to the Stata executable in Stata's application bundle
to your shell's PATH. Once that is done, you can invoke Stata from any
directory from a shell.
For example, if Stata is installed in /Applications/Stata/, then the
path to the Stata executable is
/Applications/Stata/Stata.app/Contents/MacOS/.
For Stata/SE, it is /Applications/Stata/StataSE.app/Contents/MacOS/.
For Stata/MP, it is /Applications/Stata/StataMP.app/Contents/MacOS/.
For Small Stata, it is
/Applications/Stata/smStata.app/Contents/MacOS/.
Once the path to the Stata executable is set up, type Stata to launch Stata.
If you have Stata/SE, type StataSE to start Stata.
If you have Stata/MP, type StataMP to start Stata.
If you have Small Stata, type smStata to start Stata.
Attempting to launch Stata from a symbolic link to the Stata executable will
not work.
Executing Stata in background (batch) mode
You can run large jobs in Stata in batch mode. You must have the path to
the Stata executable set up (see
Starting Stata from a shell in the FAQs).
To run a job in batch mode, open a shell by using, for example, the
Terminal application located in /Applications/Utilities/,
change to your data directory, and type
Stata -b do bigjob
This line tells Stata to execute the commands in bigjob.do, suppress
all screen output, and route the output to bigjob.log in the same
directory. If you desire a SMCL log file rather than an ASCII file, specify
-s instead of -b.
If the do-file loads datasets that require more than the default amount of
memory (10 megabytes for both Stata/SE and Stata/MP, 1 megabyte for
Intercooled Stata), you will need to allocate this to Stata when you start
it. Typing
Stata -m15 -b do bigjob
will run bigjob.do with 15 MB of memory. bigjob.do can also
try to increase the memory allocated to Stata while it is running with the
set memory command; see [GSM] C. Setting the size of memory.
While the do-file is executing, a progress bar will appear on the Stata icon
in the Dock with a rough percentage of how much of bigjob.do Stata
has executed. (Stata calculates this percentage based on the number of
characters in bigjob.do, so the percentage may not accurately reflect
the amount of time left for the job to complete.)
You can cancel the batch job by bringing Stata to the front and pressing
Command-..
Once the do-file is completed, a sound will play and the Stata icon will
bounce in the Dock. Bring Stata to the front to close it.
If you want Stata to automatically exit after running the batch do-file, use
-e instead of -b.
You do not have to run large do-files in batch mode. Any do-file that you
run in batch mode can also be run interactively. Simply start Stata, type
log using filename, and then type do filename.
You can watch the do-file run, or you can hide Stata while the do-file is
running.
Starting Stata remotely
You may login to a Macintosh running Mac OS X and launch Stata remotely to
run a batch file (not use interactively). If you wish to remotely
use Stata’s graphical interface, you must use a remote desktop
application such as
Apple Remote Desktop,
Timbuktu Pro,
or VNC Server for Mac OS X (search for VNC at
sourceforge.net). Determining which
remote desktop application to use and setting it up is beyond the scope of
this FAQ.
You must have the path to the Stata executable in your SHELL path (see
Starting
Stata from a shell in the FAQs). The environment variable
REMOTEHOST must also exist in your shell. You normally do not have
to create it but if it does not exist, Stata will not remotely execute in
batch mode properly. The environment variable REMOTEHOST simply is
the machine from which you are remotely connecting. Stata uses this
information to determine that you are executing it remotely so that it can
suppress the status bar from appearing in the Dock (otherwise, Stata will
crash).
You must also be logged in to your Mac OS X machine and the Desktop must be
visible. The user that wishes to run Stata remotely must be logged in at the
console in addition to logging in remotely. You cannot run Stata remotely if
a different user is logged in at the console. In addition, Mac OS X does not
allow GUI applications to remotely execute if the Desktop is not visible.
This means the login screen must not be visible whether it is because no
user is logged in or because you are switching users. Unfortunately,
neither limitations are avoidable by Stata.
Setting the default end-of-line delimiter
The carriage return ('\r') is the standard end-of-line delimiter for
text files on Mac OS systems. The end-of-line delimiter for text files on
Unix systems is a line feed character ('\n'). You can change the
Macintosh end-of-line delimiter to a Unix end-of-line delimiter by typing
set eolchar unix
You can change it back to a Macintosh end-of-line delimiter by typing
set eolchar mac
You can make the change permanent by using the permanent option
set eolchar unix, permanent
You may also change the setting from the General Preferences dialog by
selecting General Preferences from the Prefs menu.
|