If you want to do something dynamic without individual coding for each variable, I think you first have to determine how many variables there are in the file, and us this information either to specify a array or to create a macro %DO loop when reading the file. Array example:
data dat;
infile '~/data.dat';
input;
call symput('ANTVAR',left(put(indexc(_infile_,'|') + 1,3.)));
stop;
run;
data dat;
infile '~/data.dat' dlm='|';
array dynvar(*) dynvar1 - dynvar&ANTVAR.;
input dynvar(*);
run;
Regards,
Linus
Data never sleeps