数据请见附件。用SAS做固定月份效应是这么做吗?
step two 之后,直接做 step four 会报错。提示要保证每个月份里每个股票只能有一个观测值,查 sas support 说可以用
平均值替代多个观测值的方法来做,这样就必须用 step three 来做。
请熟悉这个问题的大侠指教。谢谢!
** Step one;
PROC SORT DATA = panal out =a;
BY month stock; RUN;
** Step two:delete observations that contains missing variables;
data b;set a;nmiss=cmiss(of informedbuy -- ret);if nmiss = 0;run;
** Step three :In order to use PROC PANEL, you need to aggregate the data so that you have unique time values within each cross section.
One possible way to do this is to run a PROC MEANS on the input data set and compute the mean of all the variables by stock and month,
and then use the output data set ;
proc means data = b noprint;
where Relationship ^= "本人";
by month stock;
var informedbuy -- ret;
output out=b(drop= _type_ _freq_) mean= n=/autoname;
run;
** Step four: fixed month effect regression;
PROC TSCSREG DATA = a outest=result noprint;
stock month stock;
model ret = dummy log_size bm r_1y/FIXone;
RUN;
quit;