I have an excel file and I read it into SAS using proc import. The Date column has a Text value: Mar 2017 How can I convert it to a date corresponding to the last day of the month? i.e.31MAR2017
1
votes
1 Answers
3
votes
You can refer to the following code for this
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;