24 %MACRO _dependency_wr(i_node=
30 %LOCAL l_child l_children l_cntChildren l_i l_node l_direction l_column l_parentList l_len l_this_node l_children_inner;
34 %IF &i_direction EQ 1 %THEN %DO;
35 %LET l_direction = called;
36 %LET l_column = caller;
39 %LET l_direction = caller;
40 %LET l_column = called;
45 select distinct &l_direction
46 into :l_children separated by
' '
48 where lowcase (&l_column)=
"%lowcase(&i_node.)"
55 put
'{ "name": "' "&i_node" '"';
58 %IF
"&l_children" NE
"" %THEN %DO;
60 %LET l_cntChildren = %SYSFUNC(countw(
"&l_children."));
61 %DO l_i=1 %TO &l_cntChildren.;
62 %LET l_node=%SYSFUNC(SCAN(&l_children,&l_i));
63 %LET l_parentList = &i_parentList. &l_node.;
66 %LET l_len = %SYSFUNC(COUNTW(&l_parentList.));
67 %LET l_this_node = %SYSFUNC(SCAN(&l_parentList., &l_len));
68 %DO l_j=1 %TO %EVAL(&l_len. - 1);
69 %IF
"%sysfunc(scan(&i_parentList., &l_j))" EQ
"&l_this_node." %THEN %DO;
75 %IF &l_i EQ 1 %THEN %DO;
78 PUT
', "children": [';
84 select distinct &l_direction
85 into :l_children_inner separated by
' '
87 where lowcase (&l_column)=
"%lowcase(&i_node.)"
92 %_dependency_wr(i_node=&l_node., i_dependencies=&i_dependencies., i_parentList=&l_parentList., i_direction=&i_direction.);
95 %IF &l_i LT &l_cntChildren. %THEN %DO;
117 %MEND _dependency_wr;