Stata 15 help for which

[R] which -- Display location and version of an ado-file


which fname[.ftype] [, all]


which looks for file fname.ftype along the S_ADO path. If Stata finds the file, which displays the full path and filename, along with, if the file is text, all lines in the file that begin with "*!" in the first column. If Stata cannot find the file, which issues the message "file not found along ado-path" and sets the return code to 111. ftype must be a file type for which Stata usually looks along the ado-path to find. Allowable ftypes are

.ado, .class, .dlg, idlg, .sthlp, .ihlp, .hlp, .key, .maint, .mata, .mlib, .mo, .mnu, .plugin, .scheme, .stbcal, and .style

If ftype is omitted, which assumes .ado. When searching for .ado files, if Stata cannot find the file, Stata then checks to see if fname is a built-in Stata command, allowing for valid abbreviations. If it is, the message "built-in command" is displayed; if not, the message "command not found as either built-in or ado-file" is displayed and the return code is set to 111.

For information on internal version control, see [P] version.


all forces which to report the location of all files matching the fname.ftype found along the search path. The default is to report just the first one found.


The which command displays the path for filename.ado and any lines in the code that begin with "*!".

. which test C:\Program Files\Stata15\ado\base\t\test.ado *! version 2.3.4 14apr2016

If we type which command, where command is a built-in command rather than an ado-file, Stata responds with

. which summarize built-in command: summarize

If command was neither a built-in command nor an ado-file, Stata would respond with

. which junk command junk not found as either built-in or ado-file r(111);

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index