pentaho/pentaho-kettle · error · RuntimeException

Unhandled SAS data type encountered

Error message

Unhandled SAS data type encountered: {type}

What it means

While building the row layout, the SasInputHelper's column callback maps each SAS column type (CHARACTER, NUMERIC) to a Kettle type; any other SAS type hits default and throws a RuntimeException naming the type. The step only supports character and numeric SAS columns.

Solutions

  1. Re-export the SAS file so all columns are character or numeric.
  2. Drop or convert the unsupported column in SAS before export.
  3. Extend the switch in SasInputHelper to map the new SAS type to a Kettle type.

Example fix

// before: default: throw new RuntimeException("Unhandled SAS data type encountered: " + type);
// after: case DATE: kettleType = ValueMetaInterface.TYPE_DATE; break;
//        default: throw new RuntimeException(...);
Defensive patterns

Strategy: validation

Validate before calling

// Reject files with unsupported SAS column types before processing
for (SasField col : sasColumns(file)) {
  switch (col.getType()) {
    case CHARACTER:
    case NUMERIC:
      break;
    default:
      throw new IllegalArgumentException("Unsupported SAS type " + col.getType() + " for column " + col.getName());
  }
}

Prevention

When it happens

Trigger: The SAS7BAT file declares a column whose type enum is neither CHARACTER nor NUMERIC, so the switch in column() reaches default.

Common situations: SAS files produced by non-standard writers emitting exotic column types; binary or date-typed columns from certain SAS export variants; library version gaps where newer SAS types are unknown.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/b16e956be4b3fa82. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputHelper.java:70

    // Determine the row layout of the file ...
    //
    try {
      rowMeta = new RowMeta();
      sasReader.read( new SasReaderCallback() {
        public void column( int index, String name, String label, SasColumnType type, int length ) {
          int kettleType = ValueMetaInterface.TYPE_NONE;
          int kettleLength;
          switch ( type ) {
            case CHARACTER:
              kettleType = ValueMetaInterface.TYPE_STRING;
              kettleLength = length;
              break;
            case NUMERIC:
              kettleType = ValueMetaInterface.TYPE_NUMBER;
              kettleLength = -1;
              break;
            default:
              throw new RuntimeException( "Unhandled SAS data type encountered: " + type );
          }
          try {
            ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( name, kettleType );
            valueMeta.setLength( kettleLength );
            valueMeta.setComments( label );
            rowMeta.addValueMeta( valueMeta );
          } catch ( Exception e ) {
            throw new SasReaderException( "Unable to create new value meta type", e );
          }
        }

        public boolean readData() {
          return false;
        }

        public boolean row( int rowNumber, Object[] rowData ) {
          return true;
        }

View on GitHub (pinned to f3058517a1)