Macro timing !!!
Since your DATA step was never completed (the run keyword is part of the incomplete assignment statement), the macro is resolved while the data step is being compiled.
Look at the log:
(run in SAS on Demand)
81 data test;
82 x=1 /* <-- intentionally leave off a semicolon to produce an error*/
83 run ;
___
22
ERROR 22-322: Syntaxfehler, erwartet wird eines der folgenden: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT,
IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.
84
85 %erreur_programme;
86
87 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observations and 2 variables.
WARNING: Datei WORK.TEST wurde nicht ersetzt, da da dieser Schritt angehalten wurde.
The WARNINGs coming from the DATA step appear after your macro call.
You must make sure that a previous step has been completed, e.g. like this:
%macro erreur_programme;
;run;quit;
/* trap error here */
%if &syserr^=0 %then %do;
%put an error occurs ;
%end ;
%mend erreur_programme;
I still recommend to use SYSCC because of this:
%put SYSERR = &syserr.;
%put SYSCC = &syscc.;
data test;
x = 1
run;
;run; /* end step */
%put SYSERR = &syserr.;
%put SYSCC = &syscc.;
data test;
x = 1;
run;
%put SYSERR = &syserr.;
%put SYSCC = &syscc.;
Log:
68
69 %put SYSERR = &syserr.;
SYSERR = 0
70 %put SYSCC = &syscc.;
SYSCC = 0
71
72 data test;
73 x = 1
74 run;
___
22
ERROR 22-322: Syntaxfehler, erwartet wird eines der folgenden: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT,
IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.
75
76 ;run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observations and 2 variables.
WARNING: Datei WORK.TEST wurde nicht ersetzt, da da dieser Schritt angehalten wurde.
NOTE: Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 629.90k
OS Memory 20388.00k
Timestamp 11.08.2025 09:43:47 vorm.
Step Count 47 Switch Count 0
Page Faults 0
Page Reclaims 64
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 16
76 ! /* end step */
77
78 %put SYSERR = &syserr.;
SYSERR = 1012
79 %put SYSCC = &syscc.;
SYSCC = 1012
80
81 data test;
82 x = 1;
83 run;
NOTE: The data set WORK.TEST has 1 observations and 1 variables.
NOTE: Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 660.03k
OS Memory 20388.00k
Timestamp 11.08.2025 09:43:47 vorm.
Step Count 48 Switch Count 2
Page Faults 0
Page Reclaims 116
Page Swaps 0
Voluntary Context Switches 10
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
84
85 %put SYSERR = &syserr.;
SYSERR = 0
86 %put SYSCC = &syscc.;
SYSCC = 1012
SYSERR is reset by a succeeding step, while SYSCC will keep its maximum value.
... View more