Help using Base SAS procedures

Retrieve column position in flat file

Not applicable
Posts: 0

Retrieve column position in flat file

When reading in a flat file, with non-standard informats for packed and signed variables, it is not "straightforward" to retrieve the actual position in the flat file from which a certain variable is read. Is it possible to retrieve those positions, or save them, after reading in the data in SAS?
Posts: 9,365

Re: Retrieve column position in flat file

Posted in reply to deleted_user
Generally, if you are reading packed and/or signed data, it is possible (sometimes) to get the program that created the file...or get the program that reads the file. For example, if you have a COBOL copybook or COBOL file description, there is a program called COB2SAS that will "translate" a COBOL file description to a SAS INPUT statement.

Otherwise, it -is- possible to figure out the position -- not easy, but possible. It requires counting bytes and looking at a hexadecimal version of the input file. This section in the documentation has some useful information:

If you have ongoing issues reading your data, you may wish to contact Tech Support for more in-depth help. They would really need to look at your data to advise you on how to read it.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation