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!
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.
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
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.
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!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.