Macros for SAS Application Developers
https://github.com/sasjs/core
mddl_sas_cntlout.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief The CNTLOUT table generated by proc format
4  @details The actual CNTLOUT table may have varying variable lengths,
5  depending on the data values, therefore the max possible lengths
6  (given various practical restrictions) are described here to enable
7  consistency when dealing with format data.
8 
9  The HLO variable may have a number of values, documented here due to the
10  256 char label description length limit:
11 
12  F=Standard format/informat.
13  H=Range ending value is HIGH.
14  I=Numeric informat.
15  J=Justification for an informat.
16  L=Range starting value is LOW.
17  M=MultiLabel.
18  N=Format or informat has no ranges, including no OTHER= range.
19  O=Range is OTHER.
20  R=ROUND option is in effect.
21  S=Specifies that NOTSORTED is in effect.
22  U=Specifies that the UPCASE option for an informat be used.
23 
24 
25 **/
26 
27 
28 %macro mddl_sas_cntlout(libds=WORK.CNTLOUT);
29 
30  proc sql;
31  create table &libds(
32  TYPE char(1) label=
33 'Format Type: either N (num fmt), C (char fmt), I (num infmt) or J (char infmt)'
34  ,FMTNAME char(32) label='Format name'
35  ,FMTROW num label=
36 'CALCULATED Position of record by FMTNAME (reqd for multilabel formats)'
37  ,START char(32767) label='Starting value for format'
38  /*
39  Keep lengths of START and END the same to avoid this err:
40  "Start is greater than end: -<."
41  Similar usage note: https://support.sas.com/kb/69/330.html
42  */
43  ,END char(32767) label='Ending value for format'
44  ,LABEL char(32767) label='Format value label'
45  ,MIN num length=3 label='Minimum length'
46  ,MAX num length=3 label='Maximum length'
47  ,DEFAULT num length=3 label='Default length'
48  ,LENGTH num length=3 label='Format length'
49  ,FUZZ num label='Fuzz value'
50  ,PREFIX char(2) label='Prefix characters'
51  ,MULT num label='Multiplier'
52  ,FILL char(1) label='Fill character'
53  ,NOEDIT num length=3 label='Is picture string noedit?'
54  ,SEXCL char(1) label='Start exclusion'
55  ,EEXCL char(1) label='End exclusion'
56  ,HLO char(13) label=
57 'More info: https://core.sasjs.io/mddl__sas__cntlout_8sas_source.html'
58  ,DECSEP char(1) label='Decimal separator'
59  ,DIG3SEP char(1) label='Three-digit separator'
60  ,DATATYPE char(8) label='Date/time/datetime?'
61  ,LANGUAGE char(8) label='Language for date strings'
62  );
63 
64  %local lib;
65  %let libds=%upcase(&libds);
66  %if %index(&libds,.)=0 %then %let lib=WORK;
67  %else %let lib=%scan(&libds,1,.);
68 
69  proc datasets lib=&lib noprint;
70  modify %scan(&libds,-1,.);
71  index create
72  pk_cntlout=(type fmtname fmtrow)
73  /nomiss unique;
74  quit;
75 
76 %mend mddl_sas_cntlout;