Here is the issue: I have a pipe delimited TXT file which has around 200 variables. Iam reading the file using INFILE statement in a DATA STEP, I want to read ALL the variables without specifying the variable names in the INPUT statement, do we have any option in SAS to do that?
PS: I dont want to use PROC IMPORT in this case due to some character constraints.
One technique of several - use a DATA step and code an INPUT; statement (no variables listed). Then use the _INFILE_ variable within a DO/END loop to parse your individual fields with the SCAN function.
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:
since this is just to investigate the content (like lining up the delimiters), I tend to type as little as possible:[pre] data ;
length col1-col300 $20 ;
infile "your input file" dsd lrecl=20000 ;
input col: ;
run ;[/pre]That provides a quick version of the data that i can examine.
My preferred viewer in these situations is FSView. It allows you to try data conversions using input() and other functions as well as data formatting ~ all dynamically, and with a facility to keep these interpretations until the next time;-)
With luck you won't be running SAS on E.G. where FSView is not possible.