Using a DATA step approach, use an INPUT statement as shown below to load the input buffer but without reading any variables and use the special SAS variable _INFILE_ to detect what input file format you are expected, then follow that SAS INPUT statement with one or more as determined by the record-format:
DATA ....;
* START OF YOUR DATA STEP CODE APPEARS HERE. ;
INPUT @;
IF _INFILE_ =: 'FORMAT1' THEN DO;
END;
ELSE IF _INFILE_ =: 'FORMAT2' THEN DO;
END;
ELSE DO;
* SHOULD NOT MAKE IT HERE. ;
ABORT ;
END;
* MORE OF YOUR DATA STEP CODE APPEARS HERE. ;
RUN;
Scott Barry
SBBWorks, Inc.