BookmarkSubscribeRSS Feed
raveena
Obsidian | Level 7

Hi ,

I have two tables test1 and test2 and need to join two tables by id and birthdat
(only by month and year not by date).The date formats are different in both the table.

Test1:
ID  bthdat
1   19400420
2   19890929
5   19830624


Test2 :
ID  bthdat
1   20/04/1938
2   29/04/1938
3   11/27/1938

Please let me know.

Thanks.

7 REPLIES 7
art297
Opal | Level 21

Are they both SAS dates but with different formats?

raveena
Obsidian | Level 7

Yes Art..

art297
Opal | Level 21

I'm confused!  Given your example, what would you expect your output to be?  If they are both SAS dates, the format should be irrelevant and the month and year functions can be used.  But I don't understand what result you are attempting to achieve.

raveena
Obsidian | Level 7

Art,

In test 1 , the format for that field is best32. and test 2 the date format is MMDDYY10.

Tom
Super User Tom
Super User

So you do NOT have two date fields. The first dataset has a number like 19,400,420 that you want to interpret as the date 1940/04/20.

To convert it use

bthdate = input(put(pthdate,z8.),yymmdd8.);

format bthdate yymmdd10.;

Also I am confused about dataset two.  You say the format is MMDDYY10., but the dates you listed are have day before month.

art297
Opal | Level 21

Tom,

Actually two appear that way and the third one appears to be mmddyy.  There is also the possibility that the big numbers represent datetime values but, if so, they are all from 1960.  I still don't have any idea of what the OP wants as a result.

Raveena, can you let us know?

raveena
Obsidian | Level 7

Hi Art,

I would like to skip this question. Even I am not so clear with this requirement.

Thanks for your valuable time in response for this question.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 7 replies
  • 738 views
  • 0 likes
  • 3 in conversation