Hello all,
I am having the same problem with "no observations." However, it only appears for some of my variables even though each variable is constructed in the same way.
My code is as follows:
tsset DSCode1 ymdate
gen F_Excess_USD_w=L.Excess_USD_w
drop if F_Excess_USD_w==.
* Dependent-sort portfolio - Size & IVOL
astile nq_Size_w = Size_w, nq(5)
bys nq_Size_w : astile IVOL_Size=IVOL_w , nq(5)
sort ymdate IVOL_Size DSCode
by ymdate IVOL_Size: drop if _n >1
* Value-weighted average excess returns of each portfolio in each month (ymdate)
bys ymdate: asgen ExUSD_1_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==1 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_1_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==1 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_1_VW_5_1_Size = ExUSD_1_VW_5 - ExUSD_1_VW_1
bys ymdate: asgen ExUSD_2_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==2 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_2_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==2 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_2_VW_5_1_Size = ExUSD_2_VW_5 - ExUSD_2_VW_1
bys ymdate: asgen ExUSD_3_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==3 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_3_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==3 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_3_VW_5_1_Size = ExUSD_3_VW_5 - ExUSD_3_VW_1
bys ymdate: asgen ExUSD_4_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==4 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_4_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==4 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_4_VW_5_1_Size = ExUSD_4_VW_5 - ExUSD_4_VW_1
bys ymdate: asgen ExUSD_5_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==5 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_5_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==5 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_5_VW_5_1_Size = ExUSD_5_VW_5 - ExUSD_5_VW_1
egen mean_Size = rowmean(EXUSD_1_VW_5_1_Size EXUSD_2_VW_5_1_Size EXUSD_3_VW_5_1_Size EXUSD_4_VW_5_1_Size EXUSD_5_VW_5_1_Size)
tsset DSCode1 ymdate
sort DSCode1 ymdate,
*Value-weighted average excess returns & t-statistics of each portfolio
newey EXUSD_1_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_2_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_3_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_4_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_5_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey mean_Size, lag(6) force
estimates table, star(.05 .01 .001)
For EXUSD_1_VW_5_1_Size and EXUSD_2_VW_5_1_Size and mean_Size, I get an output. But for the rest I do not. I have no missing observations and no string variables.
I am having the same problem with "no observations." However, it only appears for some of my variables even though each variable is constructed in the same way.
My code is as follows:
tsset DSCode1 ymdate
gen F_Excess_USD_w=L.Excess_USD_w
drop if F_Excess_USD_w==.
* Dependent-sort portfolio - Size & IVOL
astile nq_Size_w = Size_w, nq(5)
bys nq_Size_w : astile IVOL_Size=IVOL_w , nq(5)
sort ymdate IVOL_Size DSCode
by ymdate IVOL_Size: drop if _n >1
* Value-weighted average excess returns of each portfolio in each month (ymdate)
bys ymdate: asgen ExUSD_1_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==1 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_1_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==1 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_1_VW_5_1_Size = ExUSD_1_VW_5 - ExUSD_1_VW_1
bys ymdate: asgen ExUSD_2_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==2 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_2_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==2 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_2_VW_5_1_Size = ExUSD_2_VW_5 - ExUSD_2_VW_1
bys ymdate: asgen ExUSD_3_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==3 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_3_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==3 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_3_VW_5_1_Size = ExUSD_3_VW_5 - ExUSD_3_VW_1
bys ymdate: asgen ExUSD_4_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==4 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_4_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==4 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_4_VW_5_1_Size = ExUSD_4_VW_5 - ExUSD_4_VW_1
bys ymdate: asgen ExUSD_5_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==5 & IVOL_Size ==1)), w(MV_USD_w)
bys ymdate: asgen ExUSD_5_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==5 & IVOL_Size ==5)), w(MV_USD_w)
bys ymdate: asgen EXUSD_5_VW_5_1_Size = ExUSD_5_VW_5 - ExUSD_5_VW_1
egen mean_Size = rowmean(EXUSD_1_VW_5_1_Size EXUSD_2_VW_5_1_Size EXUSD_3_VW_5_1_Size EXUSD_4_VW_5_1_Size EXUSD_5_VW_5_1_Size)
tsset DSCode1 ymdate
sort DSCode1 ymdate,
*Value-weighted average excess returns & t-statistics of each portfolio
newey EXUSD_1_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_2_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_3_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_4_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey EXUSD_5_VW_5_1_Size, lag(6) force
estimates table, star(.05 .01 .001)
newey mean_Size, lag(6) force
estimates table, star(.05 .01 .001)
For EXUSD_1_VW_5_1_Size and EXUSD_2_VW_5_1_Size and mean_Size, I get an output. But for the rest I do not. I have no missing observations and no string variables.
Comment