Have you checked the value of CURDATE when run through the stored process to make sure it is valid? I'm guessing that the error could be encountered if CURDATE is not defined or contains illegal characters.
Hi Vince Curdate is defined as a datetime variable ....
Reg Q1 , how xcatly do u think the value would change once we run in a stored process , and no that vvalue is not checked hen run thru a storedprocess
What is mentioned as "Curdate is defined as a datetime variable" may be misunderstood, given you are using a SAS macro variable. Somewhere in your SAS code the macro variable &CURDATE must be assigned, possibly with a CALL SYMPUT or a %LET statement. But do consider that this macro variable is a character-string, even if it is a number -- although it may appear formatted as DATETIME, it is still a character-string of information. Or if you see a SAS message "WARNING: Apparent symbolic reference CURDATE not resolved."
-- that would lead one to believe that your program is not setting the macro variable used in the code piece you revealed in your post. Suggest some desk-checking of your SAS log output to determine where &CURDATE is assigned and also consider executing the code below to display all user-defined macro variables: