SAS column Input - Reading External text Files

Column input style is used when column positions in the input file are fixed. This kind of files are generally output of the COBOL-Mainframe based operational systems in many of the banking applications.

When SAS system uses these kind of systems as source systems then choice of Column Input style is obvious.

For example the data is given below;

External File: AccDetails.txt

00057369134510JUL2010C 0.00

00045623456723JUN2011O1000.00

10134545673421SEP1999O1000.00

10145623456130OCT2011C 0.00

Now, lets see how to use column input in this scenario.

SAS Code:

data temp;

/*infile "D:\AccDetails.txt";*/

input acc_no $ 1-12

acc_category_code $ 1-3

acc_open_date $ 13-21

acc_type_code $ 22-22

acc_min_bal_limit 23-32

;

cards;

00057369134510JUL2010C0.00

00045623456723JUN2011O1000.00

10134545673421SEP1999O1000.00

10145623456130OCT2011C0.00

run;

proc print data=temp;

run;

Here is the output generated out of the code above. One may note that acc_open_date is extracted as character variable.

Output: