Get Started

Install do2screen and run your first analysis in minutes.

Installation

Alternative: direct net install

If you prefer not to use the github command:

net install do2screen, ///
    from("https://raw.githubusercontent.com/randrescastaneda/do2screen/master/") ///
    replace
WarningSSC version is outdated

do2screen is also available on SSC (ssc install do2screen), but the SSC copy may lag behind the current release. We recommend installing from GitHub to get v5.0 and all recent fixes.

Requirements

  • Stata 16.1 or higher — v5.0 uses frames for internal data handling. Stata 14–15 users should use v3.x (available from SSC).

Your first analysis

Trace a variable

Suppose you have a do-file analysis.do and you want to know how pchincome (per-capita household income) was built. Run:

do2screen using "analysis.do", var(pchincome)

do2screen scans the file, finds where pchincome was created, and traces back through every parent variable — showing you the minimal set of lines needed to reconstruct it from scratch.

Example output:

    do-file:  analysis.do          Open
------------------------------------------------------------------------------------------------

Line   |            Writing code for:  pchincome
-------+------------------------------------------------------------------------------------------
     8:  gen wages = labourinc * 12
     9:  gen transfers = nonlabourinc + govtransfer
    13:  gen income = wages + transfers
    14:  replace income = 0 if income < 0
    15:  replace income = . if missing(wages) | missing(transfers)
    18:  egen hhincome = sum(income), by(hhid)
    22:  gen pchincome = hhincome / hhsize
    23:  replace pchincome = . if hhsize == 0
                                                           ---------- (end of analysis of pchincome)

Only the lines that matter — no noise. See the Variable Tracing article for the full feature set.

Search for a string

Find every line containing “poverty” and show 3 lines of context after each match:

do2screen using "analysis.do", find("poverty") lines(3)

See Find & Range for more examples.

Display a line range

Show lines 50 through 75 of a do-file:

do2screen using "analysis.do", range(50 75)

Next steps