mpe_getlabels.sas
Go to the documentation of this file.
1 /**
2  @file mpe_getlabels.sas
3  @brief Gets the table and column labels for a particular table
4  @details Takes labels first from mpe_datadictionary then from table metadata.
5 
6  <h4> SAS Macros </h4>
7  @li mf_getuniquename.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_getlabels(type,source,outds=mpe_getlabels);
17 %local tmpds;
18 
19 %if &type=COLUMNS %then %do;
20  %let tmpds=%mf_getuniquename();
21  proc contents noprint data=&source
22  out=&tmpds(keep=name memlabel label);
23  run;
24  proc sql ;
25  create table &outds as
26  select upcase(a.name) as name
27  ,a.memlabel
28  ,coalesce(b.dd_shortdesc,a.label) as desc
29  ,b.dd_longdesc as longdesc
30  from &tmpds a
31  left join &mpelib..mpe_datadictionary
32  (where=(&dc_dttmtfmt. < tx_to
33  and dd_source ? %upcase("&source")
34  and dd_type='COLUMN')) b
35  on scan(b.dd_source,-1,'.')=upcase(a.name);
36 %end;
37 
38 %mend mpe_getlabels;