PROC ACCESS might assign invalid INFORMAT value to Db2 column


When using an ACCESS view in a DATA step, the following error might occur:

ERROR: Width specified for format format-name is invalid.

If you add a FORMAT to a variable during the view creation, the SAS/ACCESS engine automatically assigns an INFORMAT with the same name, even if the INFORMAT is invalid. No error message is displayed until you use the VIEW is used in a DATA step. To circumvent this problem, remove the INFORMAT in a DATA or PROC step. For example:

PROC ACCESS DBMS=DB2;
    CREATE WORK.TEST.ACCESS;
    TABLE=SASMBA.TIMESTAMP;
    CREATE WORK.TEST.VIEW;
    SELECT ALL;
    FORMAT DATETIME DATETIME7.;
  RUN;
  DATA NEW;
    SET TEST;
    INFORMAT DATETIME;
  RUN;