Add-Innovation Home

About Add-Innovation

Contact Us

  SAS Institute logo.    Reading fields from delimited files.


When reading delimited files where not all fields are required, it is not necessary to specify the full length of each superfluous field, nor to give each superfluous field a unique name. Obviously fields not required at the end of each line need not be input at all.

e.g.

Data Twoflds(Keep=Fld1 Fld10);
    Infile TabFile DLM=’,’ DSD;
    Length Fld1 Fld10 $10 Skip $1;
    Input Fld1 Skip Skip Skip Skip Skip Skip Skip Skip Fld10;

is more efficient than ;

Data Twoflds(Keep=Fld1 Fld10);
    Infile TabFile DLM=’,’ DSD;
    Length Fld1 Fld10 $10 Fld2 Fld4 Fld8 Fld6 $6 Fld3 Fld5 Fld7
 Fld9 $14 Fld11 Fld12 Fld13 $2;
    Input Fld1 Fld2 Fld3 Fld4 Fld5 Fld6 Fld7 Fld8 Fld9 Fld10 Fld11       
Fld12 Fld13;