BookmarkSubscribeRSS Feed
gx2144
Calcite | Level 5

Hi, my macro will stop when running to a certain line. The log is as below: %kw_edu(se) runs well but %kw_edu(se_cr) stop running suddenly. Why did it happen?

244
245  %macro kw_edu(x);
246  proc npar1way data = shs.hsb2 wilcoxon;
247  class s1edu_cat;
248  format s1edu_cat education.;
249  var &x;
250  run;
251  %mend;
252
253  %kw_edu(se)
NOTE: Data file SHS.HSB2.DATA is in a format that is native to another host, or the file encoding
      does not match the session encoding. Cross Environment Data Access will be used, which might
      require additional CPU resources and might reduce performance.

NOTE: PROCEDURE NPAR1WAY used (Total process time):
      real time           0.87 seconds
      cpu time            0.50 seconds


254  %kw_edu((se_cr)
255  %kw_edu((zn)
256  %kw_edu((zn_cr)
257  %kw_edu((sb)
258  %kw_edu((sb_cr)
259  %kw_edu((cd)
260  %kw_edu((cd_cr)
261  %kw_edu((pb)
262  %kw_edu((pb_cr)
7 REPLIES 7
Reeza
Super User
Add the option before your macros:

options mprint mlogic;

Re-run your macros and then post the log.
gx2144
Calcite | Level 5
253  %kw_edu(se)
MLOGIC(KW_EDU):  Beginning execution.
MLOGIC(KW_EDU):  Parameter X has value se
NOTE: Data file SHS.HSB2.DATA is in a format that is native to another host, or the file encoding
      does not match the session encoding. Cross Environment Data Access will be used, which might
      require additional CPU resources and might reduce performance.
MPRINT(KW_EDU):   proc npar1way data = shs.hsb2 wilcoxon;
MPRINT(KW_EDU):   class s1edu_cat;
MPRINT(KW_EDU):   format s1edu_cat education.;
MPRINT(KW_EDU):   var se;
MPRINT(KW_EDU):   run;

NOTE: PROCEDURE NPAR1WAY used (Total process time):
      real time           0.49 seconds
      cpu time            0.37 seconds


MLOGIC(KW_EDU):  Ending execution.
254  %kw_edu((se_cr)
MLOGIC(KW_EDU):  Beginning execution.
255  %kw_edu((zn)
MLOGIC(KW_EDU):  Beginning execution.
256  %kw_edu((zn_cr)
MLOGIC(KW_EDU):  Beginning execution.
257  %kw_edu((sb)
MLOGIC(KW_EDU):  Beginning execution.
258  %kw_edu((sb_cr)
MLOGIC(KW_EDU):  Beginning execution.
259  %kw_edu((cd)
MLOGIC(KW_EDU):  Beginning execution.
260  %kw_edu((cd_cr)
MLOGIC(KW_EDU):  Beginning execution.
261  %kw_edu((pb)
MLOGIC(KW_EDU):  Beginning execution.
262  %kw_edu((pb_cr)
MLOGIC(KW_EDU):  Beginning execution.
263  %kw_edu((mo)
MLOGIC(KW_EDU):  Beginning execution.
264  %kw_edu((mo_cr)
MLOGIC(KW_EDU):  Beginning execution.
265  %kw_edu((w)
MLOGIC(KW_EDU):  Beginning execution.
266  %kw_edu((w_cr)
MLOGIC(KW_EDU):  Beginning execution.
267  %kw_edu((u)
MLOGIC(KW_EDU):  Beginning execution.
268  %kw_edu((u_cr)
MLOGIC(KW_EDU):  Beginning execution.
269  %kw_edu((sum_all)
MLOGIC(KW_EDU):  Beginning execution.
270  %kw_edu((sum_all_cr);
MLOGIC(KW_EDU):  Beginning execution.
271
272  /*smoking status*/
273  proc sort data = shs.hsb2;
274  by s1smoke_n;
275  run;
276
277  proc univariate data = shs.hsb2 noprint ;
278  histogram se se_cr zn zn_cr sb sb_cr cd cd_cr pb pb_cr mo mo_cr w w_cr u u_cr/NORMAL;
279  qqplot/normal;
280  run;
281
282  proc means data = shs.hsb2  N Mean Median  P25 P75 MaxDec = 3;
283  var se se_cr zn zn_cr sb sb_cr sum_all sum_all_cr cd cd_cr pb pb_cr mo mo_cr w w_cr u u_cr;
284  class s1smoke_n;
285  format s1smoke_n drink_smoke.;
286  run;
287
288  %macro kw_smoke(x);
289  proc npar1way data = shs.hsb2 wilcoxon;
290  class s1smoke_n;
291  format s1smoke_n drink_smoke.;
292  var &x;
293  run;
294  %mend;
295
296  %kw_smoke(se)
MLOGIC(KW_SMOKE):  Beginning execution.
MLOGIC(KW_SMOKE):  Parameter X has value se
MLOGIC(KW_SMOKE):  Ending execution.
297  %kw_smoke((se_cr);
MLOGIC(KW_SMOKE):  Beginning execution.
298  %kw_smoke((zn)
MLOGIC(KW_SMOKE):  Beginning execution.
299  %kw_smoke((zn_cr)
MLOGIC(KW_SMOKE):  Beginning execution.
300  %kw_smoke((sb)
MLOGIC(KW_SMOKE):  Beginning execution.
301  %kw_smoke((sb_cr)
MLOGIC(KW_SMOKE):  Beginning execution.
302  %kw_smoke((cd)
MLOGIC(KW_SMOKE):  Beginning execution.
303  %kw_smoke((cd_cr)
MLOGIC(KW_SMOKE):  Beginning execution.
304  %kw_smoke((pb)
MLOGIC(KW_SMOKE):  Beginning execution.
305  %kw_smoke((pb_cr)
MLOGIC(KW_SMOKE):  Beginning execution.
306  %kw_smoke((mo)
MLOGIC(KW_SMOKE):  Beginning execution.
307  %kw_smoke((mo_cr)
MLOGIC(KW_SMOKE):  Beginning execution.
308  %kw_smoke((w)
MLOGIC(KW_SMOKE):  Beginning execution.
309  %kw_smoke((w_cr)
MLOGIC(KW_SMOKE):  Beginning execution.
310  %kw_smoke((u)
MLOGIC(KW_SMOKE):  Beginning execution.
311  %kw_smoke((u_cr)
MLOGIC(KW_SMOKE):  Beginning execution.
312  %kw_smoke((sum_all)
MLOGIC(KW_SMOKE):  Beginning execution.
313  %kw_smoke((sum_all_cr)
MLOGIC(KW_SMOKE):  Beginning execution.

It stops running after the first line of %kw_edu(se)

Shmuel
Garnet | Level 18

It seems to me that you miss semicolons and you doubled the open parenthesis.

Should not code be:

%kw_edu(se);
%kw_edu(se_cr);
%kw_edu(zn);
%kw_edu(zn_cr);
%kw_edu(sb);
%kw_edu(sb_cr);
%kw_edu(cd);
%kw_edu(cd_cr);
%kw_edu(pb);
%kw_edu(pb_cr);

 

KlausBücher
Fluorite | Level 6
Your brackets are not balanced. Try %kw_edu(se_cr) instead auf %kw_edu((se_cr).
ballardw
Super User

@gx2144 wrote:

Hi, my macro will stop when running to a certain line. The log is as below: %kw_edu(se) runs well but %kw_edu(se_cr) stop running suddenly. Why did it happen?

244
245  %macro kw_edu(x);
246  proc npar1way data = shs.hsb2 wilcoxon;
247  class s1edu_cat;
248  format s1edu_cat education.;
249  var &x;
250  run;
251  %mend;
252
253  %kw_edu(se)
NOTE: Data file SHS.HSB2.DATA is in a format that is native to another host, or the file encoding
      does not match the session encoding. Cross Environment Data Access will be used, which might
      require additional CPU resources and might reduce performance.

NOTE: PROCEDURE NPAR1WAY used (Total process time):
      real time           0.87 seconds
      cpu time            0.50 seconds


254  %kw_edu((se_cr)
255  %kw_edu((zn)
256  %kw_edu((zn_cr)
257  %kw_edu((sb)
258  %kw_edu((sb_cr)
259  %kw_edu((cd)
260  %kw_edu((cd_cr)
261  %kw_edu((pb)
262  %kw_edu((pb_cr)

All of these:

254  %kw_edu((se_cr)
255  %kw_edu((zn)
256  %kw_edu((zn_cr)
257  %kw_edu((sb)
258  %kw_edu((sb_cr)
259  %kw_edu((cd)
260  %kw_edu((cd_cr)
261  %kw_edu((pb)
262  %kw_edu((pb_cr)

Starting at line 254 the (( means that the FOLLOWING line is considered as part of the preceding macro call and stacking up lots of unbalanced (.

So the SAS system is likely unstable and needs to be shut down and restarted to clean the macro stack. Then BEFORE executing that code, replace the (( with single (.

Tom
Super User Tom
Super User

It is waiting for you to submit the right parentheses for all of these unbalanced pairs.

%kw_edu( (se_cr)  /* Missing ) */

To get you session back submit:

*))))))))))))))))))))))))))))))))))))))))))))))));
ballardw
Super User

@Tom wrote:

It is waiting for you to submit the right parentheses for all of these unbalanced pairs.

%kw_edu( (se_cr)  /* Missing ) */

To get you session back submit:

*))))))))))))))))))))))))))))))))))))))))))))))));

But how many times id the OP submit the same code hoping it will run "this time"? Or just one or two of the macro calls? Possibly including attempts to redefine the macro? Likely going to be lots of fun guessing how many ) are really needed.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 828 views
  • 4 likes
  • 6 in conversation