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 **/
10 
11 
12 %macro mddl_sas_cntlout(libds=WORK.CNTLOUT);
13 
14  proc sql;
15  create table &libds(
16  TYPE char(1) label='Type of format - either N (num fmt), C (char fmt), I (num infmt) or J (char infmt)'
17  ,FMTNAME char(32) label='Format name'
18  ,FMTROW num label='CALCULATED Position of record by FMTNAME (reqd for multilabel formats)'
19  ,START char(32767) label='Starting value for format'
20  /*
21  Keep lengths of START and END the same to avoid this err:
22  "Start is greater than end: -<."
23  Similar usage note: https://support.sas.com/kb/69/330.html
24  */
25  ,END char(32767) label='Ending value for format'
26  ,LABEL char(32767) label='Format value label'
27  ,MIN num length=3 label='Minimum length'
28  ,MAX num length=3 label='Maximum length'
29  ,DEFAULT num length=3 label='Default length'
30  ,LENGTH num length=3 label='Format length'
31  ,FUZZ num label='Fuzz value'
32  ,PREFIX char(2) label='Prefix characters'
33  ,MULT num label='Multiplier'
34  ,FILL char(1) label='Fill character'
35  ,NOEDIT num length=3 label='Is picture string noedit?'
36  ,SEXCL char(1) label='Start exclusion'
37  ,EEXCL char(1) label='End exclusion'
38  ,HLO char(13) label='Additional information.
39 F=Standard format/informat.
40 H=Range ending value is HIGH.
41 I=Numeric informat.
42 J=Justification for an informat.
43 L=Range starting value is LOW.
44 M=MultiLabel.
45 N=Format or informat has no ranges, including no OTHER= range.
46 O=Range is OTHER.
47 R=ROUND option is in effect.
48 S=Specifies that NOTSORTED is in effect.
49 U=Specifies that the UPCASE option for an informat be used.'
50  ,DECSEP char(1) label='Decimal separator'
51  ,DIG3SEP char(1) label='Three-digit separator'
52  ,DATATYPE char(8) label='Date/time/datetime?'
53  ,LANGUAGE char(8) label='Language for date strings'
54  );
55 
56  %local lib;
57  %let libds=%upcase(&libds);
58  %if %index(&libds,.)=0 %then %let lib=WORK;
59  %else %let lib=%scan(&libds,1,.);
60 
61  proc datasets lib=&lib noprint;
62  modify %scan(&libds,-1,.);
63  index create
64  pk_cntlout=(type fmtname fmtrow)
65  /nomiss unique;
66  quit;
67 
68 %mend mddl_sas_cntlout;