RATS 10.1
RATS 10.1

Miscellaneous /

Long and Short Program Lines

Home Page

← Previous Next →

Continuation Lines, $ Symbol

RATS will accept instructions of any physical length. Sometimes, though, a line becomes so long that it is difficult for you to handle. To split a line into more manageable segments, put a $ character at the end of the unfinished line. You just have to be careful where you break a line. Don’t break up “tokens”, things like numbers, variable names and quoted strings. The best locations are before or after commas or arithmetic operators—after being the easiest to read, since it’s clear that the expression isn’t done. An example is

 

set gnp = consumption + investment + govtexpend + $

   export - import

 

There is no limit on the number of continuation lines allowed for a single instruction.

 

Some statistical and programming languages require a symbol, often a semi-colon (;), at the end of each command to signal to the program that a command is complete. That is not the case with RATS—it automatically assumes a command is complete when it hits the end of the physical line of text. Thus the only time you have to include a symbol (the $) at the end of a physical line is if the command isn’t done, and continues to the next line of text.

 

Multiple Statements on a Line: the ; Symbol

You actually can use the semi-colon (;) in RATS to signal the end of a command, but this is only necessary if you want to include multiple commands on a single line. This is usually only a good idea for a set of short instructions which you see almost as one, or for attaching short comments to instructions. Examples:

 

set gdp = log(gdp) ; set m1 = log(m1)

smpl 1960:1 1985:3        ;* Set Sample for Remaining Instructions

 

However, if you copy a line out of a math package which uses ; to end lines, you don’t have to delete that, as there is no harm in a ; if there is nothing after it. For instance, the translation of

 

nsave = 10000;

nburn = 0;

 

to RATS can be done by just inserting the instruction name COMPUTE (or COMP or COM, only the first three characters matter) to the start of each line:

 

comp nsave = 10000;

comp nburn = 0;


Copyright © 2025 Thomas A. Doan