非常感谢!作者: shiyiming 时间: 2011-12-4 11:03 标题: Re: 问个关于日期的问题 data test;
input temp yymmdd10.;
format temp yymmdd10.;
new=intnx('month',temp,-4,'same');
last=intnx('month',temp,-4,'end');
format new last yymmdd10.;
cards;
2011-08-24
2011-09-12
;
run;
proc print data=test;run;作者: shiyiming 时间: 2011-12-8 09:50 标题: Re: 问个关于日期的问题 谢谢帮忙,非常感谢!以前看了没看到 "same" ...,作者: shiyiming 时间: 2011-12-24 13:13 标题: Re: 问个关于日期的问题 [quote="yugao1986":3p2nd379]data test;
input temp yymmdd10.;
format temp yymmdd10.;
new=intnx('month',temp,-4,'same');
last=intnx('month',temp,-4,'end');
format new last yymmdd10.;
cards;
2011-08-24
2011-09-12
;
run;
proc print data=test;run;[/quote:3p2nd379]
我运行的结果还不是提前四个月的呀?!2011-08-24变成了 2011-04-01...作者: shiyiming 时间: 2012-2-24 10:49 标题: Re: 问个关于日期的问题 data test;
input temp yymmdd10.;
format temp yymmdd10.;
new=intnx('month',temp,-4,'same');
last=intnx('month',temp,-4,'end');
format new last yymmdd10.;
cards;
2011-08-24
2011-09-12
;
run;
proc print data=test;run;
可以的。end刚好生成的是这个月的最后一天。