I am running EG v7.15 HF8 in Windows environment with SAS 9.4.
When I run this code:
libname STULASR sasiola SIGNER='http://sas01mdc.admin.ad.cnm.edu:80/SASLASRAuthorization' HOST='sasanalytics.admin.ad.cnm.edu' PORT=10017;
proc sql;
SELECT SFRRSTS_TERM_CODE
FROM STULASR.SFRRSTS
WHERE SFRRSTS_RSTS_CODE = 'RW'
AND datepart(SFRRSTS_START_DATE) <= input("&SYSDATE", date7.)
;
quit;I get the error
ERROR: The WHERE clause '((SFRRSTS_RSTS_CODE='RW') and (DATEPART(SFRRSTS_START_DATE)<=21970))' could not be parsed as written.
Thanks for your help!
Jerry Black
Try this instead
int(SFRRSTS_START_DATE/'24:00:00't) <= input("&SYSDATE", date7.)
The only way I can get the comparison to work is to include the calculation of the datepart as one of result columns. In my case this doesn't give me what I want because I'm trying to get a distinct list of SFRRSTS_Term_Code's. But I can get what I want by encapsulating this as a subquery.
proc sql;
select distinct SFRRSTS_TERM_CODE
from
(SELECT SFRRSTS_TERM_CODE,
datepart(SFRRSTS_START_DATE) as date_only
FROM stulasr.SFRRSTS
WHERE SFRRSTS_RSTS_CODE = 'RW'
and (calculated date_only ) <= input("&SYSDATE", date7.)
)
;
quit;I was hoping it was just something I was doing wrong and there would be a cleaner solution.
Thanks for your suggestions!
Jerry
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.