@sasjs/core 5.7.1 → 5.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -318,58 +318,64 @@ create table work.&ds_self. as
318
318
  where name=dep_nm;
319
319
  quit;
320
320
 
321
- %if %mf_nobs(work.&ds_baddep.)>0 %then %do;
322
- data _null_;
323
- set work.&ds_baddep.(obs=1);
324
- call symputx('derived_err'
325
- ,cats(name,': VAR_DEPS lists ',dep_nm
326
- ,', which is not a column of the table or a derived variable'));
327
- run;
328
- %mp_abort(iftrue=1,mac=&sysmacroname,msg=%superq(derived_err))
329
- %end;
321
+ data _null_;
322
+ set work.&ds_baddep.(obs=1);
323
+ call symputx('derived_err'
324
+ ,cats(name,': VAR_DEPS lists ',dep_nm
325
+ ,', which is not a column of the table or a derived variable'));
326
+ run;
330
327
 
331
- %if %mf_nobs(work.&ds_self.)>0 %then %do;
332
- data _null_;
333
- set work.&ds_self.(obs=1);
334
- call symputx('derived_err',cats(name,': VAR_DEPS may not list itself'));
335
- run;
336
- %mp_abort(iftrue=1,mac=&sysmacroname,msg=%superq(derived_err))
337
- %end;
328
+ %mp_abort(iftrue= (0 < %mf_nobs(work.&ds_baddep.))
329
+ ,mac=&sysmacroname
330
+ ,msg=%superq(derived_err)
331
+ )
338
332
 
339
- %if %mf_nobs(work.&ds_undecl.)>0 %then %do;
340
- data _null_;
341
- set work.&ds_undecl.(obs=1);
342
- call symputx('derived_err'
343
- ,cats(name,': VAR_LOGIC references ',dep_nm
344
- ,', which is not in VAR_DEPS'));
345
- run;
346
- %mp_abort(iftrue=1,mac=&sysmacroname,msg=%superq(derived_err))
347
- %end;
333
+ data _null_;
334
+ set work.&ds_self.(obs=1);
335
+ call symputx('derived_err',cats(name,': VAR_DEPS may not list itself'));
336
+ run;
348
337
 
349
- %if %mf_nobs(work.&ds_stale.)>0 %then %do;
350
- data _null_;
351
- set work.&ds_stale.(obs=1);
352
- call symputx('derived_err'
353
- ,cats(name,': VAR_DEPS lists ',dep_nm
354
- ,', which VAR_LOGIC does not reference'));
355
- run;
356
- %mp_abort(iftrue=1,mac=&sysmacroname,msg=%superq(derived_err))
357
- %end;
338
+ %mp_abort(iftrue= (0 < %mf_nobs(work.&ds_self.))
339
+ ,mac=&sysmacroname
340
+ ,msg=%superq(derived_err)
341
+ )
358
342
 
359
- %if %mf_nobs(work.&ds_bad.)>0 %then %do;
360
- data _null_;
361
- set work.&ds_bad.;
362
- putlog 'ERR' 'OR: derived variable config: ' name= reason=;
363
- run;
364
- data _null_;
365
- set work.&ds_bad.(obs=1);
366
- call symputx('derived_err',cats(name,': ',reason));
367
- run;
368
- %mp_abort(iftrue=1
369
- ,mac=&sysmacroname
370
- ,msg=%str(Invalid derived variable configuration - &derived_err)
371
- )
372
- %end;
343
+ data _null_;
344
+ set work.&ds_undecl.(obs=1);
345
+ call symputx('derived_err'
346
+ ,cats(name,': VAR_LOGIC references ',dep_nm
347
+ ,', which is not in VAR_DEPS'));
348
+ run;
349
+
350
+ %mp_abort(iftrue= (0 < %mf_nobs(work.&ds_undecl.))
351
+ ,mac=&sysmacroname
352
+ ,msg=%superq(derived_err)
353
+ )
354
+
355
+ data _null_;
356
+ set work.&ds_stale.(obs=1);
357
+ call symputx('derived_err'
358
+ ,cats(name,': VAR_DEPS lists ',dep_nm
359
+ ,', which VAR_LOGIC does not reference'));
360
+ run;
361
+
362
+ %mp_abort(iftrue= (0 < %mf_nobs(work.&ds_stale.))
363
+ ,mac=&sysmacroname
364
+ ,msg=%superq(derived_err)
365
+ )
366
+
367
+ data _null_;
368
+ set work.&ds_bad.;
369
+ putlog 'ERR' 'OR: derived variable config: ' name= reason=;
370
+ run;
371
+ data _null_;
372
+ set work.&ds_bad.(obs=1);
373
+ call symputx('derived_err',cats(name,': ',reason));
374
+ run;
375
+ %mp_abort(iftrue= (0 < %mf_nobs(work.&ds_bad.))
376
+ ,mac=&sysmacroname
377
+ ,msg=%str(Invalid derived variable configuration - &derived_err)
378
+ )
373
379
 
374
380
  /**
375
381
  * Dependency order. The edges are between derived variables only - a
@@ -397,6 +403,7 @@ run;
397
403
 
398
404
  %let left=%mf_nobs(work.&ds_todo.);
399
405
  %let nplaced=0;
406
+ %let cyc_found=0;
400
407
 
401
408
  %do %while (&left>0);
402
409
  proc sql;
@@ -440,30 +447,37 @@ run;
440
447
  %end;
441
448
  %end;
442
449
  %end;
443
- %mp_abort(iftrue=1
444
- ,mac=&sysmacroname
445
- ,msg=%str(VAR_DEPS contains a cycle: &cyc_path)
446
- )
450
+ /* leave the loop before aborting - an abort cancels the step, and the
451
+ loop would re-enter with the ready count still zero */
452
+ %let cyc_found=1;
453
+ %let left=0;
447
454
  %end;
448
455
 
449
- /* seq carries the dependency order - the placement rounds are not name
450
- ordered, so the final merge must not rely on by name alone */
451
- data work.&ds_ready.;
452
- set work.&ds_ready.;
453
- seq=_n_+&nplaced;
454
- run;
455
- proc append base=work.&ds_placed. data=work.&ds_ready. force;
456
- run;
457
- %let nplaced=%eval(&nplaced+&nready);
456
+ %if &cyc_found=0 %then %do;
457
+ /* seq carries the dependency order - the placement rounds are not name
458
+ ordered, so the final merge must not rely on by name alone */
459
+ data work.&ds_ready.;
460
+ set work.&ds_ready.;
461
+ seq=_n_+&nplaced;
462
+ run;
463
+ proc append base=work.&ds_placed. data=work.&ds_ready. force;
464
+ run;
465
+ %let nplaced=%eval(&nplaced+&nready);
458
466
 
459
- proc sql;
460
- delete from work.&ds_todo.
461
- where name in (select name from work.&ds_ready.);
462
- quit;
467
+ proc sql;
468
+ delete from work.&ds_todo.
469
+ where name in (select name from work.&ds_ready.);
470
+ quit;
463
471
 
464
- %let left=%mf_nobs(work.&ds_todo.);
472
+ %let left=%mf_nobs(work.&ds_todo.);
473
+ %end;
465
474
  %end;
466
475
 
476
+ %mp_abort(iftrue= (&cyc_found=1)
477
+ ,mac=&sysmacroname
478
+ ,msg=%str(VAR_DEPS contains a cycle: &cyc_path)
479
+ )
480
+
467
481
  proc sort data=work.&ds_placed.;
468
482
  by name;
469
483
  run;
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "@nogoo9/gitleaks": "8.30.1-post.2"
45
45
  },
46
- "version": "5.7.1"
46
+ "version": "5.7.2"
47
47
  }