help rqrs

Title

rqrs -- Install required community-contributed packages

Syntax

rqrs
command
[ pkgname ]
[ , options ]

where command is the name of a community-contributed command
and pkgname is the name of a package

commmand may be fname[.ftype]; see which

from(directory_or_url) directory or URL
where package is found; also see net install

all download ancillary files; same as
for ssc install and net install

replace replace existing files; same as
for ssc install and net install

force install package even if command
is found along the ado-path; also see
net install

install install required package without
asking permission

Description

rqrs checks whether a specified community-contributed command is
found along the ado-path and, if it is not, downloads and
installs the required package that contains the command. A package
typically contains one or more ado-files and one or more corresponding
help files. Packages are downloaded from the SSC or, optionally,
from another location indicated by a directory or URL.

Often, a command and a package share the same name and, if they do, you
only need to specify the command name. If you specify
fname.ftype, you must also specify a package name.

Options

from(directory_or_url) specifies the directory or URL where the
required package is found. Instead of a directory or URL, from()
also accepts the following shortcuts

ssc download and install package from SSC
(the default)

net download and install package from the location set
by net from

sj#-# download and install package
from the Stata Journal (SJ) vol-issue

stb# download and install package
from the Stata Technical Bulletin (STB) issue

all is seldom used. The option downloads any ancillary files
associated with a package to the current directory () or
the directory set by net set other. Note that this option
is ignored if the required command is already installed and found
along the ado-path.

replace is seldom used. The option replaces existing files with
downloaded files. Note that this option is ignored if the required
command is already installed and found along the ado-path.

force is seldom used. The option downloads and installs the
required package even if the required command is already installed and
found along the ado-path. force implies replace.

install installs the required package without asking
permission. Default is to ask whether the required package should be
installed before downloading and installing it. Note that this option
is ignored if the required command is already installed and found
along the ado-path.

Remarks

rqrs is intended for use in do-files that call community-contributed
commands. A do-file that calls findname and esttab
(from the estout package), both from SSC, could read:

---- begin do_file.do

version

rqrs findname

rqrs esttab estout

...

findname ...

...

esttab ...

...

---- end do_file.do

The do-file above automatically downloads and installs all required
community-contributed commands -- except rqrs. Therefore, we
add two lines of code that resemble the core of rqrs internal
code.

---- begin do_file2.do

version

capture noisily which rqrs
// <- new

if ( _rc ) ssc install rqrs // <- new

rqrs findname

rqrs esttab estout

...

---- end do_file2.do

Some packages, e.g., moremata (from SSC), do not include an(y)
ado-file with the same name as the package. To check whether such packages
are installed, specify the complete name of one the files that is included
in the respective package. For example, if your do-file requires the
moremata package from SSC, you might type

. rqrs lmoremata.mlib moremata

to check whether the compiled Mata library, lmoremata.mlib is
installed. Note that you must also specify the package name moremata.

Examples

See Remarks for a worked example.

If it is not found along the ado-path, install findname from SSC

. rqrs findname

Same as above; install without asking permission

. rqrs findname , install

If it is not found along the ado-path, install findname; this time
install the latest update from the Stata Journal

. rqrs findname dm0048_4 , from(sj20-2)

If it is not found along the ado-path, install esttab from the
estout package on SSC

. rqrs esttab estout

Author

Daniel Klein

University of Kassel

klein.daniel.81@gmail.com

Also see

Online: ssc, net, adoupdate, sysdir

if installed: usepackage, adolist, copycode