Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mm_getdetails.sas
Go to the documentation of this file.
1 /**
2  @file mm_getdetails.sas
3  @brief extracts metadata attributes and associations for a particular uri
4 
5  @param uri the metadata object for which to return attributes / associations
6  @param outattrs= the dataset to create that contains the list of attributes
7  @param outassocs= the dataset to contain the list of associations
8 
9  @version 9.2
10  @author Allan Bowe
11 
12 **/
13 
14 %macro mm_getdetails(uri
15  ,outattrs=work.attributes
16  ,outassocs=work.associations
17 )/*/STORE SOURCE*/;
18 
19 data &outassocs;
20  keep assoc assocuri name;
21  length assoc assocuri name $256;
22  call missing(of _all_);
23  rc1=1;n1=1;
24  do while(rc1>0);
25  /* Walk through all possible associations of this object. */
26  rc1=metadata_getnasl("&uri",n1,assoc);
27  rc2=1;n2=1;
28  do while(rc2>0);
29  /* Walk through all the associations on this machine object. */
30  rc2=metadata_getnasn("&uri",trim(assoc),n2,assocuri);
31  if (rc2>0) then do;
32  rc3=metadata_getattr(assocuri,"Name",name);
33  output;
34  end;
35  call missing(name,assocuri);
36  n2+1;
37  end;
38  n1+1;
39  end;
40 run;
41 proc sort;
42  by assoc name;
43 run;
44 
45 data &outattrs;
46  keep type name value;
47  length type $4 name $256 value $32767;
48  rc1=1;n1=1;type='Prop';
49  do while(rc1>0);
50  rc1=metadata_getnprp("&uri",n1,name,value);
51  if rc1>0 then output;
52  n1+1;
53  end;
54  rc1=1;n1=1;type='Attr';
55  do while(rc1>0);
56  rc1=metadata_getnatr("&uri",n1,name,value);
57  if rc1>0 then output;
58  n1+1;
59  end;
60 run;
61 proc sort;
62  by type name;
63 run;
64 
65 %mend;