- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 08-18-2020 07:55 AM
(1996 views)
Keep getting an error "ERROR: Invalid date/time/datetime constant '01ju12020'd." The code used is below. I've used it multiple times in the past, but for some reason the error is only with " '01jul2020'd ". Suddenly only having this issue with the month of July.
I verified that the data is accurately formatted.
PROC SQL;
SELECT identification_number AS Product,
consumer_account_number AS Loan,
dateofaccountinformation AS DOAI,
dateoflastpayment AS DOLP,
actualpaymentamount FROM work.july2020
WHERE dateofaccountinformation BETWEEN '01ju12020'd AND '31jul2020'd AND dateoflastpayment BETWEEN '01ju12020'd AND '31jul2020'd AND actualpaymentamount = 000000000;
QUIT;
RUN;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Nevermind, just realized the issue was the " l " in jul was actually a 1. I will hang my head in shame.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You might want to check your Dateofaccountinformation variable. You can get that error when the variable is a datetime and not a date value.
Example:
1 data junk; 2 dateofaccountinformation = "03Jul2020:12:15:13"dt; 3 run; NOTE: The data set WORK.JUNK has 1 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds 4 5 proc sql; 6 select * 7 from junk 8 WHERE dateofaccountinformation BETWEEN '01ju12020'd AND 8 ! '31jul2020'd ERROR: Invalid date/time/datetime constant '01ju12020'd. 9 ; 10 quit; NOTE: The SAS System stopped processing this step because of errors.