🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Quartz | Level 8

## Transform Date from 9 to 8

Hi all,

I've read a lot of other posts and can't seem to figure out what I am doing wrong.

In one file I have a date that is YYMMDD8. and shows a calendar next to it. The type is numeric.

In another file I have a date that is DDFEBYYYY. It is a numeric date9, and says its a length 8.

I tried the following code to transform the date 9 to the 8, but it's still not right. Now one is showing a calendar next to it and the other isn't. The join fails.

Period_End1=PUT(period_end_date_num, yymmddn8.);
Period_End = input(Period_End1, 8.);

I know I'm missing something obviously simple, or I can do this is a much easier way... like convert the date 9 to a date 8? Frustrated at this point. Thank you for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
Diamond | Level 26

## Re: Transform Date from 9 to 8

In one file I have a date that is YYMMDD8. and shows a calendar next to it. The type is numeric.

In another file I have a date that is DDFEBYYYY. It is a numeric date9, and says its a length 8.

The thing we need to know is the format for each variable and whether it is character or numeric. The length is irrelevant. Show us a screen capture of what you see.

--
Paige Miller
3 REPLIES 3
Tourmaline | Level 20

## Re: Transform Date from 9 to 8

Hi @anweinbe  Here is a way to approach this kind of problem

1. Verify the type of the join keys in both datasets

2. If you notice a type mismatch, just convert one of the key to numeric or character depending upon the value. If it is date, you are better off keeping both as numeric.

3. So look for which one of the date is char, and convert the char_date using a compatible informat i.e if ddmmmyyyy, the informat is date9.

4. With the above 3 done, the JOIN becomes straight forward

HTH

PS assuming both are numeric in your sample, do not bother any conversion as those dates are mere integers and that makes a case of a straight forward join anyway

Diamond | Level 26

## Re: Transform Date from 9 to 8

In one file I have a date that is YYMMDD8. and shows a calendar next to it. The type is numeric.

In another file I have a date that is DDFEBYYYY. It is a numeric date9, and says its a length 8.

The thing we need to know is the format for each variable and whether it is character or numeric. The length is irrelevant. Show us a screen capture of what you see.

--
Paige Miller
Quartz | Level 8

## Re: Transform Date from 9 to 8

I didn't need to transform anything sheesh! I thought because one was 8 and one was 9 they wouldn't work! All that time for nothing. At least I learned something.

Thank you Paige!

Discussion stats
• 3 replies
• 591 views
• 0 likes
• 3 in conversation