BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sasphd
Lapis Lazuli | Level 10

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

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
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;

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20
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;
sasphd
Lapis Lazuli | Level 10

thanks 

and if I want just to come back by one month what I should do 

novinosrin
Tourmaline | Level 20

Do you mean previous month of the same year and the last(end) date of the month?

sasphd
Lapis Lazuli | Level 10
yes
novinosrin
Tourmaline | Level 20
data want;
set have;
b=intnx('month',a,-1,'e');
format b yymmdd10.;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1807 views
  • 2 likes
  • 2 in conversation