RATS 10.1
RATS 10.1

Instructions /

CHANGE Instruction

Home Page

← Previous Next →

CHANGE oldunit  newunit

CHANGE makes one RATS I/O unit take over the role previously assigned to another unit. It can be used with the standard I/O units, and with user-defined I/O units created with OPEN instructions. For reasons discussed below, CHANGE is only useful in a few limited situations.

Parameters

oldunit

name of the I/O unit you want to set. This will usually be INPUT, OUTPUT, or PLOT.

newunit

the existing I/O unit that you want to take the place of oldunit.

Description

CHANGE makes newunit take over the role currently assigned to oldunit. For instance,

 

change input keyboard

 

will switch the source of RATS instructions from whatever it is currently (probably a file) to the keyboard.


 

change output screen
 

switches output to the screen or edit window.


 

Examples

Suppose you are running a long batch job, and you want to direct some output (such as regression results) to one file, and other output (such as hypothesis test results) to another file. If you only need to change output files once, you could simply use two OPEN OUTPUT commands:

 

open output regress.out

linreg ...

open output hypotest.out

restrict ...

 

However, if you need to switch back and forth between the files, as in a DO loop, you would have to use the CHANGE instruction, as OPEN OUTPUT erases the previous contents of the file that is opened. For example:
 

open regfile regress.out

open testfile hypotest.out

do i=1,10

   change output regfile

   linreg ...

   change output testfile

   restrict ...

end do

 

Note that on the CHANGE instruction, you use the unit names defined by the OPEN instruction, not the file names.


 

A similar example is where you have an important piece of output which you would like to place in its own window, so that it can be found easily. This can be done by something like

 

open(window) regwindow "Key Regressions"

change output regwindow

linreg ...

....

change output screen

 

This opens a new window (which will be titled on the display as "Key Regressions") and puts all output created by the LINREG and any other instructions down to the next CHANGE OUTPUT into that window. That second CHANGE OUTPUT switches the remaining output back to the main output window.


Copyright © 2025 Thomas A. Doan