BookmarkSubscribeRSS Feed
RDS2020
Calcite | Level 5

Hi All,

When i am using below in SAS it is working fine:-

proc SQL ;
Select datepart(created_date) format=MONYY.
from ora.table1 ;
quit;

But when i am using same format in WHERE clause it is not working and giving error:-

 

PROC SQL ;
Delete from ORA.table1 
WHERE  datepart(created_date) format=MONYY. = put(today(),MONYY.) ;

 

What would be right way to get MONYY format in WHERE clause

 

Thanks,

RDS

 

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

You need:

WHERE  put(datepart(CREATED_DATE),monyy.) = put(today(),monyy.) 

ChrisNZ
Tourmaline | Level 20

It might better to use

WHERE month(CREATED_DATE)=month(today()) and year(CREATED_DATE)=year(today()) 

as this might readily be translated into a condition that Oracle can process.

Use option SASTRACE to check the Oracle query.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 541 views
  • 2 likes
  • 2 in conversation