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

I know this is a basic request (I'm a relatively new SAS user), but I keep getting the following error message:

 

ERROR: Invalid date/time/datetime constant '08/31/2010'd.

ERROR: Invalid date/time/datetime constant '03/01/2011'd.

ERROR: Syntax error while parsing WHERE clause.

 

This is my code:

data caperfy11mo01_07;

set caper.caperfy11mo01_12;

where ('08/31/2010'd < encdate1 < '03/01/2011'd);

run;

 

encdate1 is formatted mmddyy.10 in caper.caperfy11mo01_12; and when I look at the data, the values for encdate1 appear as I've written them in the code.

 

Any help is greatly appreciated. Thank you.

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

where ('08/31/2010'd < encdate1 < '03/01/2011'd); is attempting use date literals. SAS requires literals to be ddMONyy or ddMONyyyy

use

where ('31AUG2010'd < encdate1 < '01MAR2011'd);

View solution in original post

3 REPLIES 3
ballardw
Super User

where ('08/31/2010'd < encdate1 < '03/01/2011'd); is attempting use date literals. SAS requires literals to be ddMONyy or ddMONyyyy

use

where ('31AUG2010'd < encdate1 < '01MAR2011'd);

cgray
Fluorite | Level 6
Thank you for this solution. I've battled my program for 30 mins now...
sophie3
Calcite | Level 5

I have the same problem but your solution doesn't work. 

 

where=('01MAI2011'd <= Date_decision_octroi <= '30AVR2012'd)

 

Date_decision_octroi is mmddyy10.

 

 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 3 replies
  • 35669 views
  • 7 likes
  • 4 in conversation