I would say it's not possible because:
- The INFILE statement only defines where and how a record should be read into the input buffer.
- The null INPUT statement then causes SAS to read the record based on the definitions given by the infile statement. It's only reading - nothing gets altered. Only during the variable mapping against the input buffer data gets altered based on the informats.
And that's why I think the code you've given is the most efficient way possible to achieve what you want.
Well: Unless there is some undocumented system options or option for the INFILE statement I don't know of.
Since you cannot use DATALINES, you could still process against _INFILE_ after it has been brought into the PDV. The nested functions become a bit awkward but should not be too bad.
* TRYCAP.TXT contains the data line from above.;
filename txtline "c:\temp\trycap.txt";
infile txtline ;
aftera = scan(substr(_infile_,index(upcase(_infile_),'A')+1),1);
put aftera =;
proc print data=a;
This has the advantage of a case insensitive search, but the original case is preserved in the final data set.
data _null_; seeks a linguistic search with input @'string'
A really nice idea, but not yet supported. (I say YET because introduced in SAS92 are "linguistic" extensions to proc sort and others.
Back in time SAS infile options included scope to define a user module (iirc it was a feature on the mvs platform - like everything once was mvs platform;-)
A link to a sample program from (using the infile/file user exit facility) http://support.sas.com/documentation/cdl/en/hosto390/61886/HTML/default/viewer.htm#/documentation/cd...
May provide a direction to support entirely uppercasing the infile buffer, while sharing the external file reference with an infile which does not uppercase everything.
Unfortunately, I see no documentation suggesting "INFILE/FILE User Exit Facility" is available on other platforms.