*! version 1.5.8 22Oct2025

Title

bf -- Create directory structure for Dingyuan Accounting academic projects

Syntax

bf issue [, lang*uage(string)]

lang*uage(string) specify language for directory names (en/cn); may be abbreviated to lang

Description

bf creates a standardized directory structure for Dingyuan Accounting academic projects.
The command automatically detects available hard drives and prioritizes E drive, then D drive,
avoiding the system C drive (unless only C drive is available).

The language() option allows creating directory structures with either English or Chinese names.

If directories already exist, they will be overwritten/recreated to ensure a clean setup.

The command also creates ready-to-run do files in each subdirectory that demonstrate a complete
data analysis workflow using Stata's built-in auto dataset.

Version 1.5.8 adds example session display and improves error handling for log files and model results.

Options

issue specifies the issue number for creating the corresponding directory name.

lang*uage(string) specifies the language for directory names. Valid values are:

en: English directory names (default)

cn: Chinese directory names

Minimum abbreviation is lang.

Examples

bf 202501

Create directory structure for Dingyuan Accounting Issue 202501 with English names.

bf 202501, lang(en)

Create directory structure for Dingyuan Accounting Issue 202501 with English names (using abbreviation).

bf 202501, language(cn)

Create directory structure for Dingyuan Accounting Issue 202501 with Chinese names.

Example Session

After running the bf command, you will see an example session showing how to execute the complete analysis workflow:

. bf 202512, lang(cn)
D:\益友学术\鼎园会计 202512

Current working directory: D:\益友学术\鼎园会计 202512

Dingyuan Accounting Issue 202512 workspace created successfully!
Includes the following subdirectories: 模型 数据 程序 报告
Ready-to-run do files have been created in each subdirectory.
Execution order: 1. data 2. program 3. model 4. report
You can run the complete analysis by executing the report generation do file.

Example Session:

To run the complete analysis workflow, use the following commands:

1. Create data management:
do "D:\益友学术\鼎园会计 202512\数据\数据管理.do"

2. Define programs:
do "D:\益友学术\鼎园会计 202512\程序\程序定义.do"

3. Run model estimation:
do "D:\益友学术\鼎园会计 202512\模型\模型估计.do"

4. Generate final report:
do "D:\益友学术\鼎园会计 202512\报告\报告生成.do"

Or run only the report generation to execute all steps automatically:
do "D:\益友学术\鼎园会计 202512\报告\报告生成.do"

The command creates the following directory structure on the selected drive:

English structure:

1. Academic Friends - base directory

2. Dingyuan Accounting [issue] - project directory

3. model - for statistical models

4. data - for datasets

5. program - for Stata do-files

6. report - for reports and outputs

Chinese structure:

1. 益友学术 - base directory

2. 鼎园会计 [issue] - project directory

3. 模型 - for statistical models

4. 数据 - for datasets

5. 程序 - for Stata do-files

6. 报告 - for reports and outputs

Ready-to-Run Do Files

The command creates the following ready-to-run do files in each subdirectory:

data/ directory:

data_management.do or 数据管理.do - Loads and processes the auto dataset, creates new variables

program/ directory:

program_definition.do or 程序定义.do - Defines reusable programs for data description and regression analysis

model/ directory:

model_estimation.do or 模型估计.do - Runs statistical models, performs diagnostics, and saves results in both Stata (.ster) and text (.txt) formats

report/ directory:

report_generation.do or 报告生成.do - Generates tables, graphs, and final reports

Data Analysis Workflow

The do files demonstrate a complete analysis workflow that can be run immediately:

1. Run data_management.do first to process the data

2. Run program_definition.do to define analysis programs

3. Run model_estimation.do to estimate models (automatically runs previous steps)

4. Run report_generation.do to generate final outputs (automatically runs all previous steps)

All do files use absolute paths to ensure they can be run from any location and will find all required files.

Execution Options

Users can run the do files in two ways:

Option 1: Run files individually in sequence

Option 2: Run only the report generation file, which automatically calls all previous steps

Drive Selection Algorithm

The command uses the following algorithm to select the appropriate drive:

1. Prefer E drive if available

2. Then prefer D drive if available

3. Then any non-C drive

4. Finally use C drive if no other options

Program Definitions

The program definition do file creates two reusable programs:

describe_data - Provides comprehensive data description with describe, summarize, and tabstat

run_regression - Runs regression analysis and stores estimates

Output Files

The analysis workflow generates the following output files:

auto_processed.dta - Processed dataset in data directory

model_results.ster - Model estimates in Stata format (for internal use)

regression_results.txt - Regression results in text format (readable)

analysis_report.log - Complete analysis log

descriptive_stats.rtf - Descriptive statistics table

regression_results.rtf - Regression results table

price_mpg_scatter.png - Scatter plot of price vs MPG

price_weight_scatter.png - Scatter plot of price vs weight

Authors

Wu Lianghai

School of Business, Anhui University of Technology(AHUT), Ma'anshan, China

E-mail:agd2010@yeah.net

Chen Liwen

School of Business, Anhui University of Technology(AHUT), Ma'anshan, China

E-mail:2184844526@qq.com

Wu Hanyan

School of Economics and Management, Nanjing University of Aeronautics and Astronautics (NUAA), Nanjing, China

E-mail:2325476320@qq.com

Acknowledgments

We sincerely appreciate Christopher F. Baum for his prompt guidance and revision suggestions.

Also see

Online: mkdir, cd