getcols.sas
Go to the documentation of this file.
1 /**
2  @file getcols.sas
3  @brief Retrieves column info to enable population of dropdowns
4  @details
5 
6  <h4> SAS Macros </h4>
7  @li dc_assignlib.sas
8  @li mf_getvalue.sas
9  @li mp_abort.sas
10 
11  @version 9.2
12  @author 4GL Apps Ltd
13  @copyright 4GL Apps Ltd. This code may only be used within Data Controller
14  and may not be re-distributed or re-sold without the express permission of
15  4GL Apps Ltd.
16 
17 **/
18 %mpeinit()
19 
20 
21 %let ds=%mf_getvalue(work.iwant,libds);
22 %dc_assignlib(READ,%scan(&ds,1,.))
23 
24 proc contents noprint data=&ds
25  out=droplist1 (keep=name type length label varnum format:);
26 run;
27 data cols(keep=name type length varnum format label);
28  set droplist1(rename=(format=format2 type=type2));
29  name=upcase(name);
30  if type2=2 then do;
31  length format $49.;
32  if format2='' then format=cats('$',length,'.');
33  else if formatl=0 then format=cats(format2,'.');
34  else format=cats(format2,formatl,'.');
35  type='C';
36  ddtype='CHARACTER';
37  end;
38  else do;
39  if format2='' then format=cats(length,'.');
40  else if formatl=0 then format=cats(format2,'.');
41  else if formatd=0 then format=cats(format2,formatl,'.');
42  else format=cats(format2,formatl,'.',formatd);
43  type='N';
44  if format=:'DATETIME' then ddtype='DATETIME';
45  else if format=:'DATE' then ddtype='DATE';
46  else if format=:'TIME' then ddtype='TIME';
47  else ddtype='NUMERIC';
48  end;
49  if label='' then label=name;
50 run;
51 
52 %mp_abort(iftrue= (&syscc ne 0)
53  ,mac=&_program..sas
54  ,msg=%str(syscc=&syscc)
55 )
56 
57 %webout(OPEN)
58 %webout(OBJ,cols)
59 %webout(CLOSE)
60 
61 
62 %mpeterm()