將兩個檔案依date這個變數joinby,然後希望個別regress取得residuals。
----------------------以下為我的code-----------------------------
use"C:\Users\Survivor\Desktop\上市週報酬率.dta", clear
joinby  date using"C:\Users\Survivor\Desktop\大盤週報酬率.dta"
statsby _b, by(code date) saving(test.dta, replace): reg r ir mr            (regress)
merge m:1 code date using test.dta             
gen yhat = ir*_b_ir + mr*_b_mr +  _b_cons        (yhat)
gen res2 = r - ir*_b_ir -mr*_b_mr - _b_cons         (residual)
------------------------------------------------------------------------------------
[size=13.3333330154419px](以下是結果)
[size=13.3333330154419px]
[size=13.3333330154419px] merge m:1 code date using 上市週報酬率.dta             
[size=13.3333330154419px]
[size=13.3333330154419px]    Result                           # of obs.
[size=13.3333330154419px]    -----------------------------------------
[size=13.3333330154419px]    not matched                             0
[size=13.3333330154419px]    matched                            65,535  (_merge==3)
[size=13.3333330154419px]    -----------------------------------------
[size=13.3333330154419px]
[size=13.3333330154419px]. gen yhat = ir*_b_ir + mr*_b_mr +  _b_cons        
[size=13.3333330154419px](65535 missing values generated)
[size=13.3333330154419px]
[size=13.3333330154419px]. gen res2 = r - ir*_b_ir - mr*_b_mr - _b_cons        
[size=13.3333330154419px](65535 missing values generated)
[size=13.3333330154419px]
[size=13.3333330154419px]end of do-file
[size=13.3333330154419px]
joinby之前沒問題直到regress時出現65535個 missing values,請問為什麼我的regress會失敗呢?