BookmarkSubscribeRSS Feed
podarum
Quartz | Level 8

Hi ,

 

I have to pull these dates form our Taradata datawarehouse in this format  30APR2015 and it's a date9. format

 

I am trying SAS SQL to pull trhe date but getting no results...error actually.

 

I tried  :

where date = '30APR2016'

where date = '30APR2016'd

where put (date, date9.) = '30APR2015'

where put (date, yymmdd10.)= '30APR2015'

where put (date, yymmdd9.)= '30APR2015'

where input (date, yymmdd10.)= '30APR2015'

where input (date, yymmdd9.)= '30APR2015'

 

Nothing works...

Got this error:

 

ERROR: Teradata prepare: Syntax error: Data Type "snap_dt" does not match a Defined Type name.

SQL statement was: select * from ddwv01.MORTG_CLM_LOSS as LP where put(snap_dt, yymmdd9.)

= '30APR2016'.

 

 

Any suggestions?  Thanks.

6 REPLIES 6
Steelers_In_DC
Barite | Level 11

I would pull the date in it's current format.  If you need to change it to date9. do it in SAS after you have the dataset.

Reeza
Super User
What does the rest of your query look like? Are you using pass through sql or proc sql or a data step?
podarum
Quartz | Level 8

proc sql

Reeza
Super User
Teradata typically stores dates as date times.
Try

where datepart(date) = '30APR2016'd
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Start by doing a simple:

create temp_dataset as select * from your_table

 

Now, goto your work library, and open the properties of the temp_dataset.  What format is the variable in question, what data does it hold?  Post a proc contents if your still having problems, and some of the data.

podarum
Quartz | Level 8

Thanks everyone...

 

This worked : 

WHERE DATE = DATE'2016-04-30'

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
  • 6 replies
  • 1723 views
  • 0 likes
  • 4 in conversation