Help using Base SAS procedures

Retrieve column position in flat file

Reply
N/A
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?
SAS Super FREQ
Posts: 8,743

Re: Retrieve column position in flat file

Hi:
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.
http://support.sas.com/techsup/technote/ts620.html
http://support.sas.com/techsup/technote/ts536.html

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:
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a001239773.htm
http://support.sas.com/techsup/technote/ts642.html
http://support.sas.com/kb/16/565.html
http://support.sas.com/techsup/technote/ts654.pdf

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.

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 102 views
  • 0 likes
  • 2 in conversation