I need help figuring out how to add this SQL code to SAS using proc sql. I get the error messages that are listed below the code.
AND lh.CreateDate >= CAST(CONVERT(VARCHAR(8),GETDATE()-1,1) as DATETIME)
ERROR: Function VARCHAR could not be located.
ERROR: Function GETDATE could not be located.
ERROR: Expression using subtraction :smileyminus: requires numeric types.
ERROR: Function CONVERT could not be located.
ERROR: Function CAST could not be located.
ERROR: Expression using greater than or equal (>=) has components that are of different data
types.
ERROR: The following columns were not found in the contributing tables: DATETIME.
What is the intent of the code. CAST() and GETDATE() are not functions available in SAS.
If you want to get today's date use the TODAY() or DATE() function.
If you want to get the current datetime then use the DATETIME() function.
Which you use will depend on what you want to do and whether the variable CreateDate contains dates or datetime values.
If CreateDate is a SAS Date something like this:
AND lh.CreateDate >= (today() - 1)
Hi,
Cast is a teradata function.and If you want to use in porc sql. you can define while creating libname.
libname teradatalib teradata user=user_name pw=pwd cast=yes;
Thanks
What is the intent of the code. CAST() and GETDATE() are not functions available in SAS.
If you want to get today's date use the TODAY() or DATE() function.
If you want to get the current datetime then use the DATETIME() function.
Which you use will depend on what you want to do and whether the variable CreateDate contains dates or datetime values.
Thanks, with your help I figured it out.
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: