You should make it a point to post syntactically valid code.
Your data step produces this log:
24 Data_null_; __________ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 25 Format c date7. e date7.; ______ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 26 C= datepart (datwtime (); _ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 27 E=c+7; _ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 28 Call symput ('cdate2', " ' " | |vvalue (e) | |" 'd"); ____ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 29 Call symput ('cdate', " ' " | |vvalue (c) | |" 'd"); ____ 180 2 Das SAS System 08:44 Friday, August 11, 2017 ERROR 180-322: Statement is not valid or it is used out of proper order. WARNING: Apparent symbolic reference CDATE2 not resolved. 30 31 %put &cdate2. ; &cdate2. 32 %put &cdate.; WARNING: Apparent symbolic reference CDATE not resolved. &cdate.
So the people that are supposed to help you will first have to fix that heap of bugs.
Note that posting code into the main posting window will reformat, drop blanks, replace certain character combinations with smileys, etc.
Use the {i} or "little running man" buttons for posting code!
(I've probably written that a thousand times now, memo to self: create keyboard macro)
A condition like
WHERE AL1.trans datepart (AL1,TRANS)>&CDATE2 AND DATEPART (AL1.TRANS)=<&CDATE;
wont't work in a data step or proc sql.
Please post the code you really ran. You just need to copy/paste that working code into one of the windows mentioned above.
And post the attributes of the variable al1.trans (type, length, format).
Is that all your code ?
If YES than you have mixed data step code with sql code.
if NOT please post your full code or log.
Anyhow, your where staement relates only to the DATEPART and not to the time.
Please explain your issue with an example - what havr you expected and what have you got .
You should make it a point to post syntactically valid code.
Your data step produces this log:
24 Data_null_; __________ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 25 Format c date7. e date7.; ______ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 26 C= datepart (datwtime (); _ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 27 E=c+7; _ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 28 Call symput ('cdate2', " ' " | |vvalue (e) | |" 'd"); ____ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 29 Call symput ('cdate', " ' " | |vvalue (c) | |" 'd"); ____ 180 2 Das SAS System 08:44 Friday, August 11, 2017 ERROR 180-322: Statement is not valid or it is used out of proper order. WARNING: Apparent symbolic reference CDATE2 not resolved. 30 31 %put &cdate2. ; &cdate2. 32 %put &cdate.; WARNING: Apparent symbolic reference CDATE not resolved. &cdate.
So the people that are supposed to help you will first have to fix that heap of bugs.
Note that posting code into the main posting window will reformat, drop blanks, replace certain character combinations with smileys, etc.
Use the {i} or "little running man" buttons for posting code!
(I've probably written that a thousand times now, memo to self: create keyboard macro)
A condition like
WHERE AL1.trans datepart (AL1,TRANS)>&CDATE2 AND DATEPART (AL1.TRANS)=<&CDATE;
wont't work in a data step or proc sql.
Please post the code you really ran. You just need to copy/paste that working code into one of the windows mentioned above.
And post the attributes of the variable al1.trans (type, length, format).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.