I have dates in column A and I want to move back like that column B
Column B give the date at the end of the year before the date in column A
column A
19850331
19850630
19850930
19851231
19860331
19860930
19861231
19870331
column B
19841231
19841231
19841231
19841231
19851231
19851231
19851231
19861231
data have;
input a yymmdd10.;
format a yymmdd10.;
cards;
19850331
19850630
19850930
19851231
19860331
19860930
19861231
19870331
;
data want;
set have;
b=intnx('year',a,-1,'e');
format b yymmdd10.;
run;
data have;
input a yymmdd10.;
format a yymmdd10.;
cards;
19850331
19850630
19850930
19851231
19860331
19860930
19861231
19870331
;
data want;
set have;
b=intnx('year',a,-1,'e');
format b yymmdd10.;
run;
thanks
and if I want just to come back by one month what I should do
Do you mean previous month of the same year and the last(end) date of the month?
data want;
set have;
b=intnx('month',a,-1,'e');
format b yymmdd10.;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.