我曾经YYQ5.
根据日期MMDDYY10.
格式创建一个新变量。问题是我的年度季度的日期范围与SAS年度季度的日期范围不同。
我最初有这样的东西:
data recog_flag;
set recog;
if '01nov2010'd <= FINAL_DECISION <= '31jan2011'd then quart = 1;
else if '01feb2011'd <= FINAL_DECISION <= '30apr2011'd then quart = 2;
else if '01may2011'd <= FINAL_DECISION <= '31jun2011'd then quart = 3;
else if '01aug2011'd <= FINAL_DECISION <= '31oct2011'd then quart = 4;
else if '01nov2011'd <= FINAL_DECISION <= '31jan2012'd then quart = 5;
else if '01feb2012'd <= FINAL_DECISION <= '30apr2012'd then quart = 6;
run;
编辑:更新日期标签。
谢谢。
是的,您可以将INTCK()函数与间隔时间一起使用:
data have;
do date='01Nov2010'd to '30Apr2012'd;
output;
end;
format date MMDDYY10.;
run;
data want;
set have;
quart=intck('qtr.2','01Nov2010'd,date)+1;
run;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句