mpe_dsmeta.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Gets table metadata
4  @details Runs mp_dsmeta and adds datadictionary info
5 
6  <h4> SAS Macros </h4>
7  @li mp_dsmeta.sas
8 
9  @version 9.2
10  @author 4GL Apps Ltd
11  @copyright 4GL Apps Ltd. This code may only be used within Data Controller
12  and may not be re-distributed or re-sold without the express permission of
13  4GL Apps Ltd.
14 **/
15 
16 %macro mpe_dsmeta(libds, outds=dsmeta);
17  %local ddsd ddld notes lenstmt memname;
18  %let lenstmt=length ods_table $18 name $100 value $1000;
19  %let libds=%upcase(&libds);
20 
21  %if "%scan(&libds,2,-)" ne "FC" %then %do;
22  %let memname=%scan(&libds,2,.);
23  %mp_dsmeta(&libds, outds=&outds)
24  %end;
25  %else %do;
26  %let memname=%scan(&libds,2,.-);
27  data &outds;
28  &lenstmt;
29  set sashelp.vcatalg;
30  ods_table=cats(objtype);
31  name=cats(objname);
32  value=catx(' ',objdesc,'(modified:',put(modified,datetime19.),')');
33  where libname="%scan(&libds,1,.)" and memname="&memname";
34  keep ods_table name value;
35  run;
36  proc sort; by ods_table name;run;
37  %end;
38 
39  data _null_;
40  set &mpelib..mpe_datadictionary;
41  where &dc_dttmtfmt < tx_to & dd_source="&memname" & dd_type='TABLE';
42  call symputx('ddsd',dd_shortdesc,'l');
43  call symputx('ddld',dd_longdesc,'l');
44  run;
45 
46  data &outds;
47  &lenstmt;
48  if last then do;
49  ODS_TABLE='MPE_DATADICTIONARY';
50  NAME='DD_SHORTDESC';
51  VALUE="&ddsd";
52  output;
53  NAME='DD_LONGDESC';
54  VALUE="&ddld";
55  output;
56  end;
57  set &outds end=last;
58  output;
59  run;
60 
61  data _data_;
62  set &mpelib..mpe_tables;
63  where libref="%scan(&libds,1,.)"
64  & dsn="%scan(&libds,2,.)"
65  & &dc_dttmtfmt<tx_to;
66  &lenstmt;
67  ODS_TABLE='MPE_TABLES';
68  array c _character_;
69  array n _numeric_;
70  do over c;
71  name=upcase(vname(c));
72  value=c;
73  output;
74  end;
75  do over n;
76  name=upcase(vname(n));
77  value=cats(n);
78  output;
79  end;
80  keep ods_table name value;
81  run;
82 
83  proc append base=&outds data=&syslast;
84  run;
85 
86 
87 %mend mpe_dsmeta;