* 复现任务:Angrist 与 Krueger (1991),Table IV 第1列 OLS 和第2列 2SLS。 * 输入:从作者 MIT 存档自行取得 NEW7080.dta,放在本练习目录 data/ 下。 * 输出:replication.log、estimates.csv;第一阶段作为补充诊断写入日志。 * 样本:1970年普查,1920–1929年出生男性;保留出生年固定效应。 * 原列使用常规标准误,不擅改稳健或聚类口径;未覆盖其他列/整篇论文。 * 在新练习会话和空目录运行:clear 会清内存,replace 会覆写同名结果。 version 17 set more off set linesize 255 capture log close log using "replication.log", text replace use "data/NEW7080.dta", clear rename v4 education rename v9 log_weekly_wage rename v16 census rename v18 quarter_birth rename v27 year_birth keep if inrange(year_birth, 1920, 1929) assert census == 70 assert _N == 247199 assert inrange(quarter_birth, 1, 4) assert !missing(education, log_weekly_wage, year_birth) file open results using "estimates.csv", write text replace file write results "model,n,coefficient,standard_error,ci_lower,ci_upper" _n regress log_weekly_wage education i.year_birth matrix OLS = r(table) file write results "ols," %12.0f (e(N)) "," %21.15g (_b[education]) "," %21.15g (_se[education]) "," %21.15g (OLS[5,1]) "," %21.15g (OLS[6,1]) _n ivregress 2sls log_weekly_wage i.year_birth (education = i.quarter_birth i.quarter_birth#i.year_birth) matrix IV = r(table) file write results "2sls," %12.0f (e(N)) "," %21.15g (_b[education]) "," %21.15g (_se[education]) "," %21.15g (IV[5,1]) "," %21.15g (IV[6,1]) _n estat firststage file close results display "AK91_TABLE_IV_TWO_COLUMNS_COMPLETED" log close