BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
xliu1
Quartz | Level 8

I need to add a filter using a date variable which is in character format (e.g., 2017-07-01 00:00:00). Here is my sas code. I keep getting error message in sas log: ERROR: CLI cursor fetch error: [Oracle][ODBC][Ora]ORA-01861: literal does not match format string. I know there is something wrong with the date format in where clause but not sure how to modify it. Anyone can help me with this? Thanks.

proc sql;

create table EMPLOYEE as

select A.EMPLID,
       A.USF_ID,
	   A.LAST_NAME,
	   A.FIRST_NAME,
       A.SEX_DESC,
       A.ETHNIC_GROUP_DESC,
	   A.JOB_EFFDT,
	   A.HIRE_DATE,
       A.REHIRE_DATE,
	   A.SERVICE_DATE,
	  A.TERMINATION_DATE,
	   A.POSITION_NBR,
	   A.POSITION_EFFDT,
	   A.POSITION_DESC,
	   A.POSITION_ACTION_DESC,
	   A.POSITION_ACTION_DATE,
	   A.DEPTID,
	   A.DEPTID_DESC,
	   A.VP_AREA_DESC,
	   P.PAY_END_DT as PayPeriodEndDate 
 
FROM Dwhouse.Gems_ps_pay_check_d3 P
LEFT JOIN Dwhouse.Gems_appointment_d3 A on P.EMPLID = A.EMPLID
where A.LOCATION_CODE = '04'
     and P.PAY_END_DT >= '2019-07-01'

order by EMPLID, SERVICE_DATE;

quit;
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Can you try--

If numeric

 P.PAY_END_DT >= '01jul2019'd

If char

 input(P.PAY_END_DT,yymmdd10.) >= '01jul2019'd

 

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

Can you try--

If numeric

 P.PAY_END_DT >= '01jul2019'd

If char

 input(P.PAY_END_DT,yymmdd10.) >= '01jul2019'd

 

xliu1
Quartz | Level 8

Thanks! This works out as I expected. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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