我有一个Excel文件,我使用PROC进口读入SAS。日期列有一个文本值:2017年3月我怎样才能将其转换为相应月份的最后一天的日期? i.e.31MAR2017
你可以参考下面的代码本
data have;
dt='Mar2017';
output;
dt='Apr2017';
output;
dt='May2017';
output;
dt='Aug2017';
output;
run;
data want;
set have;
newdt=input(dt,MONYY7.); /*Convert text into date, it will point to first day*/
lastDay=intnx ('month',newdt,0,'E'); /*Find the last day of month*/
format newdt lastDay date9.;
run;