When you use the FORMAT procedure with a CNTLIN data set, the action might fail if the lengths of the START and END columns are different. In this scenario, an error similar to the following might appear in the SAS® log:
ERROR: Cannot mix missing and nonmissing values in the same range: 1234-..
The error might occur in either of the following scenarios.
Scenario 1:
- The length of the START column is shorter than the length of the END column.
- The first observation in the CNTLIN data set contains the special 'LOW' value in the START column and a number in the END column.
Scenario 2:
- The length of the END column is shorter than the length of the START column.
- The first observation in the CNTLIN data set contains the special 'HIGH' value in the END column and a number in the START column.
An example execution might look similar to the following:
1 data work.sample ;
2 attrib fmtname length=$ 9 ;
3 attrib start length=$ 8 ;
4 attrib end length=$ 7 ;
5 attrib label length=$ 10 ;
6 fmtname = 'myfmt' ;
6 type= 'N' ;
8 start = '1234' ;
9 end = 'HIGH' ;
10 label = 'My Label' ;
11 run ;
NOTE: The data set WORK.SAMPLE has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.08 seconds
cpu time 0.03 seconds
11 proc format cntlin=work.sample ;
ERROR: Cannot mix missing and nonmissing values in the same range: 1234-..
11 ! run ;
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set WORK.SAMPLE.
The documentation for the PROC FORMAT statement has been updated to highlight that an error might occur if the lengths are different.
The best practice is to ensure that the START and END columns have the same length. For example, in the above code, both START and END should have a length of 8.