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!!!