CORE
mm_gettree.sas
Go to the documentation of this file.
1 
28 %macro mm_getTree(
29  tree=
30  ,inds=
31  ,outds=work.mm_getTree
32  ,mDebug=0
33  );
34 
35 %local mD;
36 %if &mDebug=1 %then %let mD=;
37 %else %let mD=%str(*);
38 %&mD.put Executing mm_getTree.sas;
39 %&mD.put _local_;
40 
41 data &outds;
42  length treeuri __parenturi __type __name $256 treepath $512;
43 %if %length(&inds)>0 %then %do;
44  set &inds;
45 %end;
46  __rc1=metadata_resolve("&tree",__type,treeuri);
47 
48  if __type='Tree' then do;
49  __rc2=metadata_getattr(treeuri,"Name",__name);
50  treepath=cats('/',__name);
51  /* get parents */
52  do while (metadata_getnasn(treeuri,"ParentTree",1,__parenturi)>0);
53  __rc3=metadata_getattr(__parenturi,"Name",__name);
54  treepath=cats('/',__name,treepath);
55  treeuri=__parenturi;
56  end;
57  treeuri="&tree";
58  end;
59  else do;
60  __rc2=metadata_pathobj(' ',"&tree",'Folder',__type,treeuri);
61  treepath="&tree";
62  end;
63 
64  &mD.put (_all_)(=);
65  drop __:;
66  if treeuri ne "" and treepath ne "" then output;
67  stop;
68 run;
69 %mend;