I got the following log with the same errors as before with new code same data set. DATA NEWT1; INPUT SUBJ TRT $ AUCL AUCI CPEAK HALF TPEAK TLAG ; CARDS; 1 A 2079.16 2087.26 2556.76 1.1 1.5 1 2 A 1377.26 . 777.38 . 8 8 3 A 1899.42 1908.64 2002.591 1.13 1.5 1 ; RUN; 85 %macro splitdsnbyobs(dsn,splitby); /* defined macro with arguments to be used in code */ 86 %RecsInDS(&dsn,no_obs); /* Read more about this macro at 86 ! http://sastechies.blogspot.com/2009/11/ways-to-count-number-of-obs-in-datase t.html */ 87 88 /*calculate the final obs for each do loop iteration*/ 89 90 %macro finalobs; 91 %if %sysfunc(ceil(&i * &splitby.)) gt &no_obs %then &no_obs; 92 %else %sysfunc(ceil(&i * &splitby.)); 93 %mend finalobs; 94 /* keep the observations from firstobs= and obs=*/ 95 %do i=1 %to %sysfunc(ceil(&no_obs/&splitby)); 96 data &dsn.&i.; 97 set &dsn (firstobs=%sysfunc(floor(&i.-1)*&splitby.+1) obs=%finalobs); 98 run; 99 %end; 100 %mend splitdsnbyobs; 101 102 %splitdsnbyobs(newt1,3); /* line added to execute the macro code */ NOTE: Line generated by the invoked macro "SPLITDSNBYOBS". 102 %RecsInDS(&dsn,no_obs); %macro finalobs; %if %sysfunc(ceil(&i * &splitby.)) gt &no_obs %then &no_obs; %else _ 180 102 ! %sysfunc(ceil(&i * &splitby.)); %mend finalobs; WARNING: Apparent invocation of macro RECSINDS not resolved. MPRINT(SPLITDSNBYOBS): %RecsInDS(newt1,no_obs); ERROR 180-322: Statement is not valid or it is used out of proper order. WARNING: Apparent symbolic reference NO_OBS not resolved. WARNING: Apparent symbolic reference NO_OBS not resolved. ERROR: Argument 1 to function CEIL 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: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: %sysfunc(ceil(&no_obs/&splitby)) ERROR: The %TO value of the %DO I loop is invalid. ERROR: The macro SPLITDSNBYOBS will stop executing. 103 104 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
... View more