Help using Base SAS procedures

joining the table by date field

Reply
Frequent Contributor
Posts: 90

joining the table by date field

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.

PROC Star
Posts: 7,492

joining the table by date field

Are they both SAS dates but with different formats?

Frequent Contributor
Posts: 90

joining the table by date field

Yes Art..

PROC Star
Posts: 7,492

joining the table by date field

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.

Frequent Contributor
Posts: 90

joining the table by date field

Art,

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

Super User
Super User
Posts: 7,083

joining the table by date field

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.

PROC Star
Posts: 7,492

joining the table by date field

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?

Frequent Contributor
Posts: 90

joining the table by date field

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.

Ask a Question
Discussion stats
  • 7 replies
  • 180 views
  • 0 likes
  • 3 in conversation