I have some basic SAS code that I'm not trying to turn into a macro. I've taken the quotes off of the the first argument to avoid that error, but now I have a new one. What is wrong with this? This works just fine: proc sql; create table tester as select distinct a.*, b.newvalue from datasetabc as a, datasetxyz as b where a.id = b.id and month(a.date) = month(intnx('month',b.date,1)) and year(a.date) = year(intnx('month',b.date,1)) order by id, a.date; quit; However, when I put it inside a macro, this gives an error: %macro test_intnx() proc sql; create table tester as select distinct a.*, b.newvalue from datasetabc as a, datasetxyz as b where a.id = b.id and month(a.date) = month(%sysfunc(intnx(month,b.date,1))) and year(a.date) = year(%sysfunc(intnx(month,b.date,1))) order by id, a.date; quit; %mend(); %test_intnx(); Error: ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number. ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated. ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number. ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated.
... View more