BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
reneerabbit
Calcite | Level 5

I'm needing to use a termination date in date9. format to join to another table that has monthly records with a time_id also in date9. format.  The problem is that the time_id always references the last day of the month (31JAN2015, 28FEB2015, etc.) and my termination date can be any day of the month.  I just need to use a member_id in combination with the termination month/year to join to the other table with member_id and month/year, disregarding day of the month.  SUBSTR requires characters and the dates are numeric.  I tried using MONTH(TERM_DT) but that gives the number of the month and I need the 3 character format for month.  Any other ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Use the INTNX function to move your date to the last of the month.

intnx('month', date, 0, 'e')

View solution in original post

4 REPLIES 4
Reeza
Super User
Use the INTNX function to move your date to the last of the month.

intnx('month', date, 0, 'e')
reneerabbit
Calcite | Level 5

Thanks - this worked perfectly!  I didn't know just how versatile intnx was...

Reeza
Super User
Or the PUT function and a year month format.

put(termination_date, yymon7.)=put(time_id, yymon7.);
Ksharp
Super User

It would be better to post some data to explain your questions.  GROUPFORMAT + FORMAT is for such scenario .

 

 

data want;
 merge a b;
 by date groupformat ;
 format date monyy.;
run;

 

 

 

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 702 views
  • 1 like
  • 3 in conversation