Desktop productivity for business analysts and programmers

comparing date formats

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

comparing date formats

HI..

 

I have a limited knowledge of SAS. I am an  AS400 developer who recently jumped to this platform when my company offered me the opportunity.

 

I am using EG (7.1) and trying to do a left join on 2 tables using a date field.

Table1 has a format of  20OCT2016:00:00:00

Table2 has a format of 20OCT2016

 

EG wants me to a manual join.. since there is no natural matching columns between the two tables.

I can connect the 2 date columns together and run it without errors, but my results show as NULL values. so the match didnt work

Can I extract(substring) the date only from table1 and do this?

 

 

Regards,

Chris 

- Chris N.

Accepted Solutions
Solution
‎10-25-2016 01:29 PM
Respected Advisor
Posts: 4,992

Re: comparing date formats

Most likely, what you are seeing are formatted versions of the data values (not the actual values).

 

If that's the case, the issue is that one table contains a date-time combination but the other is just the date.  Try matching this way:

 

datepart(table1.fieldname) = table2.fieldname

 

It's the most likely way to resolve this, but sometimes it takes inspecting the data more closely.

View solution in original post


All Replies
Solution
‎10-25-2016 01:29 PM
Respected Advisor
Posts: 4,992

Re: comparing date formats

Most likely, what you are seeing are formatted versions of the data values (not the actual values).

 

If that's the case, the issue is that one table contains a date-time combination but the other is just the date.  Try matching this way:

 

datepart(table1.fieldname) = table2.fieldname

 

It's the most likely way to resolve this, but sometimes it takes inspecting the data more closely.

Contributor
Posts: 31

Re: comparing date formats

Thanks for the help, that worked great!

 

As I start doing more programming, I'm sure I'll be posting out here quite a bit with questions. 

 

-Chris N.

 

- Chris N.
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 237 views
  • 0 likes
  • 2 in conversation