Date: Wed, 27 Jan 1999 07:36:59 -0600
Reply-To: Ross Bettinger <rbettin@MAGNIFY.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Ross Bettinger <rbettin@MAGNIFY.COM>
Subject: appending data to existing file
Content-Type: text/plain; charset=us-ascii
I remember that there was some discussion concerned with manipulating
input records in excess of 200 bytes long using character strings that
are limited to 200 bytes. I recently solved a problem similar to this
when I had to append new data to existing records on a flat file.
Instead of reading the two files into SAS datasets and then merging and
rewriting the flat file, I experimented with the _infile_ buffer and
found that the following code performed my task:
data _null_ ;
file 'test.dat12' ; /* new file containing old file records +
new data */
infile 'test.dat1' ; /* old file containing records to which new
data will be appended */
input ; /* fill the _infile_ buffer */
put _infile_ @@ ; /* put to new file but do not advance the
record pointer */
infile 'test.dat2' ; /* file containing records with new data to
be appended to old file records */
input ;
put _infile_ ; /* append new info to contents of _infile_ buffer
*/
run ;
If anyone has occasion to use this code and finds anomalies or
improvements, please inform the rest of us.
Ross Bettinger