SASUnit Examples  Version 1.5.0
_dependency.sas
Go to the documentation of this file.
1 
24 %MACRO _dependency(i_dependencies =
25  ,i_macroList = dir
26  );
27 
28  %LOCAL l_countObs l_name l_children;
29 
30  %** get number of obs;
31  PROC SQL noprint;
32  select count(*)
33  into :l_countObs
34  from &i_macroList.
35  ;
36  QUIT;
37 
38  /* initiate loop over all macros referenced in data set */
39  %DO l_i=1 %TO &l_countObs;
40  /* get libref and dataset name for dataset you will work on during this iteration */
41  DATA _NULL_;
42  * read one observation;
43  SET &i_macroList. (firstobs=&l_i. obs=&l_i.);
44  CALL SYMPUT("l_name", trim(name));
45  RUN;
46 
47  /* Create Json for calling hierachy (macros called by A) */
48  FILENAME json_out "&g_target/tst/crossreference/&l_name._caller.json";
49  DATA _NULL_;
50  FILE json_out;
51  RUN;
52  /* Call writeJsonNode to write json */
53  %_dependency_wr(i_node=&l_name, i_direction=1, i_dependencies=&i_dependencies);
54  /* Finalize json by adding curly bracket */
55  DATA _NULL_;
56  FILE json_out mod;
57  PUT "}";
58  RUN;
59 
60  /* Create Json for calling hierachy in reverse direction (macros that call A) */
61  FILENAME json_out "&g_target/tst/crossreference/&l_name._called.json";
62  DATA _NULL_;
63  FILE json_out;
64  RUN;
65  /* Call writeJsonNode to write json */
66  %_dependency_wr(i_node=&l_name, i_direction=0, i_dependencies=&i_dependencies);
67  /* Finalize json by adding curly bracket */
68  DATA _NULL_;
69  FILE json_out mod;
70  PUT "}";
71  RUN;
72 
73  FILENAME json_out;
74  %END;
75 %MEND _dependency;