|
June 2006 Technical Tip – Self-documenting data files in SAS Often when I create a small data file for use with SAS, I will create a corresponding text file which describes that data. For example, here is orditem.txt:
...and here is orditem.dat, the data file described by orditem.txt:
No one would question the appropriateness of having a documentation file such as orditem.txt. But how much better is it to have the documentation embedded within the data file itself! Consider, for example, selfdoc.dat which follows. Lines with an asterisk in the first column are to be treated as comments, not data:
Reading such a dataset and bypassing the documentation lines is a trivial process if you make use of the linehold character. The linehold character is a single trailing at sign and indicates that subsequent input statements in the same pass through the DATA step will read from the same physical record. Here's the SAS program which reads selfdoc.dat:
We hope you will consider Caliber Data Training when you are in need of high quality SAS training. Go to the articles index. Written by Bill Qualls. Copyright © 2006 by Caliber Data Training 800.938.1222 |