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