数据date的值为DATETIME19.格式,具体如31MAY2005:00:00:00。用了year(),substr(),都没用。请教高手指点,谢谢!
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
data a; input date $19. ;cards;31MAY2005:00:00:00;run;
data b;set a;x = scan(date,1,' :');y = substr(x,6,4);format y f4.0 ;run;
非常感谢eveningbmu,我用了你的方法,但是结果不是很好,估计是我这个数据有些问题。
我现在用了year(datepart(maturity)),问题已经解决。
谢谢!