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
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 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.