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

I'm trying to concatenate 4 data elements together to create a unique ID, the last data element is a date. When I use the CATS function, it is converting the date into the numeric equivalent and that's not what I want. I want the actual date 

cats(a.agreement_type,a.customer_number,a.trade_number,a.maturity_date). What do I need to do for the date?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Yeah, this is a common gotcha. SAS will convert numeric using the BEST format which puts it in as a number, not the date. You need to use PUT() to convert it to the format desired as shown in BallardW code.

View solution in original post

3 REPLIES 3
ballardw
Super User

@titanbob wrote:

I'm trying to concatenate 4 data elements together to create a unique ID, the last data element is a date. When I use the CATS function, it is converting the date into the numeric equivalent and that's not what I want. I want the actual date 

cats(a.agreement_type,a.customer_number,a.trade_number,a.maturity_date). What do I need to do for the date?

 

Thanks


Possibly something like

 

cats(a.agreement_type,a.customer_number,a.trade_number, put(a.maturity_date, date9.) ).

if you want the date to appear like 20OCT2018 if the value is an actual SAS date value. Pick the format you want in place of date9 .

 

Reeza
Super User
Yeah, this is a common gotcha. SAS will convert numeric using the BEST format which puts it in as a number, not the date. You need to use PUT() to convert it to the format desired as shown in BallardW code.
titanbob
Calcite | Level 5

Thanks for the help, really appreciate it!!!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 3 replies
  • 2573 views
  • 2 likes
  • 3 in conversation