I have a .sas file with proc format for 200 variables (let's call it FORMATS.sas). Now, when I read in actual data from an INFILE statement (let's call this DATAFILE), I %include the FORMATS.sas file. Then, in the data step I have a format statement which then lists all 200 variable names and their format labels, so imagine: format var1 var1. var2 var2. var3 var3. ; (...etc until all 200 are listed). There are 2 issues with this process: 1. If I choose to only read in 10 of the 200 variables in the INFILE, the FORMAT statement will give 190 errors. So how can I only apply formats to variables that actually have been read in (without manually commenting out 190 lines in the format statement)? 2. How can I make this more efficient in general? I would like it to just have a database that it automatically grabs the format labels since the variable and its corresponding format is exactly the same name?
... View more