help shellout


shellout -- Opens documents and their programs from inside Stata.

Multiple Syntax

shellout application [, cd] where application is the name of a software application to be opened.

shellout [using] filename [, cd] where filename takes the form of a document with a known extension, such as .doc, .do, .dta, .txt, .xls, .xml, etc.

Options cd should not be used, except to tell Stata that the program in question is located in the current directory.


shellout opens a document from inside Stata without having to specify the exact file path of the program. It also opens an application with or without specifying a file document to be opened.

shellout is a shell wrapper designed for Windows XP/NT. Unlike shell, implements a nested DOS command. The DOS Window is told to close itself.

shellout was originally written to accompany outreg2 for automatic opening of non-Stata documents.


shellout wsestata.exe shellout using myfile.xml shellout using "c:\myfolder\myfile.doc" shellout myfile.xml shellout

The first line will open another Stata executable. The second line will open a document named myfile.xml in Excel. The third line will open a document named myfile.doc in Word. The fourth line will do the same thing without invoking the "using" syntax. The fifth line is the equivalent of -do me- in another Stata executable, or was it -run me-....


A parameter is any value passed into a batch script. shellout will work with parameters in the following examples (assuming you have Stata SE)

shellout shellout wsestata.exe shellout wsestata.exe shellout wsestata.exe shellout wsestata di "Bite Me" shellout notepad "Bite Me"

The first line will open three Stata executables in a daisy-chain. The second line will open a Stata executable with a "Bite Me" message. The third line will open a (new) notepad file called "Bite Me".

Advanced Parameters

You can save a batch of parameters in a file and invoke it under shellout much like calling upon a do-file. Learn some DOS commands if you want to implement it.


Roy Wada

Also see

[D] Shell