Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

stacy deps

Show dependency tree for Stata scripts

Synopsis

stacy deps <SCRIPT> [OPTIONS]

Description

Analyzes a Stata script to find all files it depends on (via do, run, include) and package dependencies (via require). Shows a tree view of the dependency graph, detects circular dependencies, and identifies missing files.

require statements (including cap require and capture require) are recognized as package dependencies and shown as leaf nodes in the tree.

A path that holds a Stata macro, such as do "$root/prep.do", only points somewhere once Stata expands the macro. stacy reads the script but does not run it, so it lists the path as written and marks it as resolved at run time. Such a path is not a missing file and does not fail the command.

Arguments

ArgumentDescription
<SCRIPT>Script to analyze (required)

Options

OptionDescription
--flatShow flat list instead of tree

Examples

Show dependency tree

stacy deps main.do

Show flat list

stacy deps --flat main.do

Exit Codes

CodeMeaning
0Analysis complete
1Circular dependencies detected
3Script not found, or a dependency is missing

See Exit Codes Reference for details.

See Also