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