You might be able to make a program smart enough to read both file formats.
First define ALL of the variables. Just attaching a format or an informat to variable will only DEFINE the variable as a side effect. None of the variables in your example need to have either formats or informats attached to them. SAS knows how to read and write simple numbers and character strings. Normally you only need to add formats and informats for date and time variables.
data want;
length name $10 age 8 res_num $7 idnum $2 gender $1 ;
If the line is designed to be fixed width then read it using formatted input. If it is delimited by tabs then read it using list mode. This is actually a good example of why you should be using the newer (less than 30 years old) TRUNCOVER option instead of the older less useful MISSOVER option. When you read with list mode it makes no difference, but in formatted mode it can cause short values to be set to missing.
How can you tell which files have the fifth variable? Let's assume that the tab delimited files have the fifth variable and the fixed format files do not.
So something like this to read the lines conditionally might work.
infile "filename" dsd dlm='09'x truncover ;
input @;
if index(_infile_,'09'x) then input name age res_num idnum gender ;
else input name $10. age 2. res_num $7. gender $1. ;
... View more