Fix Stata path errors
BNR info-hub Technical Manual
1 Fix Stata path errors
1.1 Purpose
Use this guide when a Stata DO file cannot find a path, dataset, ADO file, output folder, or local configuration file.
The usual causes are:
- Stata was started from the wrong working directory
bnr_paths_LOCAL.dois missing or has the wrong paths- the private data folder is missing
- the expected frozen dataset is not in the expected location
- an ADO helper is not in
scripts/stata/ado/
2 Stage 1: Confirm the working directory
In Stata, run:
pwdThe result should be the repo root:
C:/yoshimi-hot/output/analyse-bnr/info-hub
If not, set it explicitly:
cd "C:/yoshimi-hot/output/analyse-bnr/info-hub"3 Stage 2: Check local path configuration
From the repo root in Stata, run:
confirm file "scripts/stata/config/bnr_paths_LOCAL.do"If this fails, copy:
scripts/stata/config/bnr_paths_TEMPLATE.do
and rename the copy to:
scripts/stata/config/bnr_paths_LOCAL.do
Open:
scripts/stata/config/bnr_paths_LOCAL.do
Check these lines:
global BNR_REPO "C:/yoshimi-hot/output/analyse-bnr/info-hub"
global BNR_PRIVATE "C:/yoshimi-hot/output/analyse-bnr/info-hub-private"Both paths must match the local machine.
bnr_paths_LOCAL.do is machine-specific and should not be committed to Git.
Only the template should be committed:
scripts/stata/config/bnr_paths_TEMPLATE.do
4 Stage 3: Check the private data folder
In PowerShell, run:
Test-Path C:\yoshimi-hot\output\analyse-bnr\info-hub-privateExpected result:
True
The 2023 CVD prep file expects the frozen source dataset under:
info-hub-private/data/frozen/releases/y2023/m12/
For the case-count pilot, the expected dataset is:
bnr-cvd-indiv-full-202312-v01.dta
5 Stage 4: Check ADO helpers
Active ADO helpers should live here:
scripts/stata/ado/
In Stata, after loading local paths, run:
adopathCheck that the project ADO folder appears.
6 Stage 5: Rerun the failing command
After fixing a path issue, rerun the same command that failed, for example:
do "scripts/stata/briefings/cvd_cases_2023/cvd_cases_2023.do"