Page 1 of 1
Replacing reports
Posted: Thu Jul 15, 2010 10:05 am
by rsdeacle
I am working on a program that contains a loop that estimates the same model on several sets of dependent variables. Within the loop are the following instructions that open text-file report and append the results from each set of dependent variables to the report.
open(append) copy "filename.txt"
report(action = show , unit = copy )
When I revise my program and re-run it, the new report is appended to the old report. I get around this by deleting the report file before re-running the program. Is there a RATS command that will replace the old report with the new, or delete the old report before creating a new one with the same name?
Re: Replacing reports
Posted: Thu Jul 15, 2010 11:44 am
by moderator
If you want to replace the entire file, just don't use the APPEND option the first time the file is opened.
I'm not sure you actually need the APPEND option at all, unless you are closing the file each time for some other reason. For example, have you tried:
open copy filename.txt
do ... (or other looping instruction)
...
report(unit=copy,...)
...
end
close copy
It's possible that REPORT closes the file automatically--if so, then you would just need to use OPEN(APPEND) inside the loop, but try it without any OPEN inside the loop first.
Regards,
Tom Maycock
Re: Replacing reports
Posted: Thu Jul 15, 2010 1:14 pm
by rsdeacle
I see how that works. The problem I have (that I didn't explain in the initial post) is that I'm actually trying to make _two_ tables in each loop. So I think I need to have the open and close commands within the loop.
On a related note, I see how to put one and two significance stars on an entry in a report cell. Is there anyway to get three stars?
Re: Replacing reports
Posted: Thu Jul 15, 2010 3:21 pm
by moderator
If you need to write to two files, have them both open with different unit names. For example:
open repone file1.txt
open reptwo file2.txt
do ... (or other looping instruction)
...
report(unit=repone,...)
...
report(unit=reptwo,...)
end
close copy
rsdeacle wrote:
On a related note, I see how to put one and two significance stars on an entry in a report cell. Is there anyway to get three stars?
Not automatically. The SPECIAL option is limited to the specific choices listed in the manual.
Regards,
Tom Maycock