Hi guys Goodmorning,
in this data set i want including last date like below
2016-02-29
2017-05-31
2018-06-30
2019-02-28
data dsn;
input date yymmdd10.;
format date yymmdd10.;
datalines;
201602
201705
201806
201902
;
run;
Ok. Do like this then
data dsn;
input date;
format date;
datalines;
201602
201705
201806
201902
;
run;
data want;
set dsn;
date=intnx('month', input(put(date, 6.), yymmn6.), 0, 'e');
format date yymmdd10.;
run;
Assuming your data is sorted.. Also, I corrected your test data
data dsn;
input date :yymmdd10.;
format date yymmdd10.;
datalines;
2016-02-29
2017-05-31
2018-06-30
2019-02-28
;
run;
data want;
set dsn end=lr;
if lr;
run;
Hi Draycut
keep it datalines as it is
201602
201705
201806
201902
but i want output like below
2016-02-29
2017-05-31
2018-06-30
2019-02-28
Sorry, but
data dsn;
input date yymmdd10.;
format date yymmdd10.;
datalines;
201602
201705
201806
201902
;
run;
is not working at all, please fix it. As soon as you have a sas-date, you can use intnx to move it to end of the month by using
date = intnx('month', date, 0, 'E');
Ok. Do like this then
data dsn;
input date;
format date;
datalines;
201602
201705
201806
201902
;
run;
data want;
set dsn;
date=intnx('month', input(put(date, 6.), yymmn6.), 0, 'e');
format date yymmdd10.;
run;
Thank you very much
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.