Resources

Transitive Closure: Bug Tracking Circular Dependencies (onete06)


/*****************************************************************************/
/*                                                                           */
/*          S A S   S A M P L E   L I B R A R Y                              */
/*                                                                           */
/*    NAME: onete06                                                          */
/*   TITLE: Transitive Closure: Bug Tracking Circular Dependencies (onete06) */
/* PRODUCT: OR                                                               */
/*  SYSTEM: ALL                                                              */
/*    KEYS: OR                                                               */
/*   PROCS: OPTNET, PRINT, SQL                                               */
/*    DATA:                                                                  */
/*                                                                           */
/* SUPPORT:                             UPDATE:                              */
/*     REF:                                                                  */
/*    MISC: Example 6 from the OPTNET documentation.                         */
/*                                                                           */
/******************************************************************************/


data DefectLinks;
   input defectId $ linkedDefect $ linkType $ when datetime16.;
   format when datetime16.;
   datalines;
D0096978 S0711218 DUPTO 20OCT10:00:00:00
S0152674 S0153280 DUPTO 30MAY02:00:00:00
S0153280 S0153307 DUPTO 30MAY02:00:00:00
S0153307 S0152674 DUPTO 30MAY02:00:00:00
S0162973 S0162978 DUPTO 29NOV10:16:13:16
S0162978 S0165405 DUPTO 29NOV10:16:13:16
S0325026 S0575748 DUPTO 01JUN10:00:00:00
S0347945 S0346582 DUPTO 03MAR06:00:00:00
S0350596 S0346582 DUPTO 21MAR06:00:00:00
S0539744 S0643230 DUPTO 10MAY10:00:00:00
S0575748 S0643230 DUPTO 15JUN10:00:00:00
S0629984 S0643230 DUPTO 01JUN10:00:00:00
;


proc optnet
   loglevel        = moderate
   graph_direction = directed
   data_links      = DefectLinks;
   data_links_var
      from         = defectId
      to           = linkedDefect;
   cycle
      out          = Cycles
      mode         = all_cycles;
   transitive_closure
      out          = TransClosure;
run;
%put &_OROPTNET_;
%put &_OROPTNET_CYCLE_;
%put &_OROPTNET_TRANSCL_;

proc sql;
   create table Chains as
   select defectId, linkedDefect from TransClosure
      except
   select defectId, linkedDefect from DefectLinks;
quit;


proc print data=Cycles noobs label;
run;


proc print data=Chains noobs label;
run;