In order to add the OTHER range, the variable HLO must be set to 'O'. The variable HLO's value denotes a special range in an input control data set. The 'O' (an uppercase o) denotes the special range of OTHER. START and END will default to '**OTHER**' when HLO has a value of 'O'. FMTNAME will have uppercase values irrespective of what is assigned in a DATA step.
The sample code on the Full Code tab illustrates this.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
/* This is a sample data set that is used to create the data set that is */
/* read in with the CNTLIN= option on the PROC FORMAT statement. */
data one;
input x y $;
datalines;
1 blue
2 red
;
/* This example uses the END= option to determine when the end of the input data */
/* set has been reached. When the last observation has been read, the DO loop */
/* will write out one more observation, setting the value of HLO to 'O' and */
/* assigning the LABEL for the values of the OTHER range. */
data two;
length label $ 20;
set one end=last;
fmtname='colors';
start=x;
label=y;
output;
if last then do;
hlo='o';
label='unknown color';
output;
end;
run;
proc print;
run;
proc format cntlin=two fmtlib;
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
---------------------------------------------------------------------------- | FORMAT NAME: COLORS LENGTH: 13 NUMBER OF VALUES: 3 | | MIN LENGTH: 1 MAX LENGTH: 40 DEFAULT LENGTH 13 FUZZ: STD | |--------------------------------------------------------------------------| |START |END |LABEL (VER. 8.2 16DEC2004:14:22:30)| |----------------+----------------+----------------------------------------| | 1| 1|BLUE | | 2| 2|RED | |**OTHER** |**OTHER** |UNKNOWN COLOR | ----------------------------------------------------------------------------
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> FORMAT |
Date Modified: | 2005-10-26 03:03:00 |
Date Created: | 2005-01-26 16:16:16 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | All | 8 TS M0 | n/a |