Example append data to an existing file

For questions and discussion related to reading in and working with data.
Gilbril
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Example append data to an existing file

Unread post by Gilbril »

Dear Tom,
could you give any exapmple code of how to append series to an existing file without overwriting the contained data.

I tried :

1. open copy with Format free, but the Labels of the series vanish.

2. Open(append) does not work either when the Format of the file is rat.

Is there any example?

Is there a way to open all Excel files within one specific Folder? By this I could collect the data and write it ton large Excel file.

Thanks a lot !
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Example append data to an existing file

Unread post by TomDoan »

open(append) works only with certain formats---unlabeled text formats like FREE and Fortran format, and also the RATS portable text format. Most of the other formats require that a complete table/file be written in a single go.

For RATS format, instead of using COPY(FORMAT=RATS), use the data editing instructions (DEDIT to create/open the file, STORE and/or INCLUDE for adding information, SAVE when you're done).
Gilbril
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Re: Example append data to an existing file

Unread post by Gilbril »

Dear Tom,

thanks a lot with dedit it works to append Data sequentially to a rat data file within one file.
But I do want to use the rat file to collect forecast series from several programs.

When I try to append data from an other forecast file it does not work.
The series from a different program are not appended.

How can I enable the read only mode of the rat file and use it to collect data from several programs?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Example append data to an existing file

Unread post by TomDoan »

You use DEDIT(NEW) to start a new data file and DEDIT (without NEW) when you are adding to an existing file. That would allow you to combine series from multiple programs.
Post Reply