I have dates from two different datasets and I want to find the difference between the two dates such that only those with difference under 20 is included in the PROC SQL table. However, I am getting errors.
Dataset 1 = s_cases (has one date variable date_1)
Dataset 2 = q_Cases (has another date variable date_2)
Also, in the code below I have done a case when step to get info on some additional cases, you can ignore that part.
proc sql;
create table cases_data as select
sum(case when " p ID"n in (select "p ID"n from s_cases where "p ID"n ne '') then 1 else 0 end) as additional_case
from q_case
where intck('day',s_case.date1, q_case.date2)<20;
quit;
Log errors:
ERROR: Unresolved reference to table/correlation name s_cases. ERROR: Function INTCK requires a numeric expression as argument 2. ERROR: Expression using less than (<) has components that are of different data types.
Extra note: the two variables are already in a numeric format, I do not know why SAS is asking for a numeric expression as argument 2.
pID? If not you will get potentially elevated counts due to cross joining.