BookmarkSubscribeRSS Feed
mraza12
Calcite | Level 5

I want to convert a sas date to Teradata date in the where clause below:

 

Sample code:

 

proc sql;

create table temp_4 as

select a.counter, max(c.ID) as CI_ID

from temp_3 a

left join table.abc b ON a.H_ID = b.X_ID

inner join table.def c ON b.CI_ID = c.CI_ID

left join table.ghi d ON c.CI_ID = d.CI_ID

where b.type ='HI' and substr(c.CI_LAST_NM,1,12) = a.Surname and substr(c.CI_FRST_NM,1,7) = a.First_Name

and c.CI_BIR_DT = a.DOB and c.CI_SEX_C = a.gen

group by a.counter

 ;

quit;

 

c.CI_BIR_DT = a.DOB CI_BIR_DT is a Teradata date and a.DOB is the sas date.

I tried a few options but failed to get the correct result. Please advise.

 

Many Thanks!

 

 

 

1 REPLY 1
tomrvincent
Rhodochrosite | Level 12

Try formatting temp_3.DOB as format yymmdd10. before joining.  That's worked before.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 2149 views
  • 0 likes
  • 2 in conversation