Your main problem was trying to call INTNX in open code. You must wrap in in $SYSFUNC for it to work. Same is true of the TODAY functions. Give this a try:
data test1;
A="this is a test data!";
TodayD=today();
format TodayD date9.;
run;
%macro check_DS_CRDATE(lib,DS);
proc contents data=&lib..&ds. noprint out=DS_Date (keep= MEMNAME MEMLABEL CRDATE MODATE); run;
proc sql noprint;
select distinct CRDATE, datepart(CRDATE)
into :CreatedTime_&ds., :CreatedDate_&ds.
from DS_Date;
quit;
%put data &ds. was created at =&&CreatedTime_&ds.;
%put data &ds. was created on =&&CreatedDate_&ds.;
%let tday = %sysfunc(intnx(%str(week1.1),%sysfunc(today()),0));
%put tday = &tday;
%if &&CreatedDate_&ds.=%sysfunc(intnx(%str(week1.1),%sysfunc(today()),0)) %then %do;
data test_successful;
ref=today();
A="Great effort!";
LastSunday=intnx('week1.1',ref,0);
quit;
%end;
%mend check_DS_CRDATE;
%check_DS_CRDATE(work, test1);
... View more