USEPACKAGE: Stata module to find, verify, and install the user-written packages (and data) a do-file needs
Eric Booth
Statistical Software Components from Boston College Department of Economics
Abstract:
usepackage takes the list of user-written packages a do-file needs and makes sure they are installed, so a shared do-file can open with one line instead of a stack of ssc install / net install commands or a paragraph telling the reader to go run findit. For each name it checks whether it is already installed, then SSC, then the net search catalogue (which covers the Stata Journal and the STB), reporting what it found, what it skipped, and why. The name you ask for is often a COMMAND rather than a PACKAGE -- dropmiss ships inside dm89_2, bacon inside st0197. usepackage resolves that case, but because the mapping is inferred it asks before installing, and in a batch run it declines rather than guessing (see noconfirm). Ancillary files (a package's example do-files and datasets, which net install does not place on the adopath) are fetched by default and reported; noancillary skips them. github() installs a package straight from a GitHub repository, probing branch (main, then master) and the usual layouts for stata.toc; give it a bare owner and it searches that account's repositories by name, or set the global usepackage_github once and any unresolved name is looked for there. It uses only raw.githubusercontent.com for installs, so it is not rate-limited the way the GitHub code-search API is. data() fetches data files out of a GitHub repository, guessing the live branch and transparently resolving Git LFS pointers, which the raw endpoint otherwise serves as a 130-byte text stub that Stata cannot read. scan() reads a do-file and reports which of its commands do not resolve on this machine. usepackage does not check versions; pair it with require (Correia and Seay, Stata Journal 24(4)) when you need minimum or exact versions pinned. Version 1.0.0 (2011) was written at the Public Policy Research Institute, Texas A&M University.
Language: Stata
Requires: Stata version 16.0
Keywords: user-written packages; findit; search; ssc install; net install; ancillary files; github; git lfs; reproducibility (search for similar items in EconPapers)
Date: 2026-07-30
Note: This module should be installed from within Stata by typing "ssc install usepackage". The module is made available under terms of the MIT license (https://opensource.org/licenses/MIT).
References: Add references at CitEc
Citations:
Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/e/example_usepackage.do example do-file (text/plain)
http://fmwww.bc.edu/repec/bocode/u/usepackage.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/u/usepackage.sthlp help file (text/plain)
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s459828
Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php
Access Statistics for this software item
More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().