RATS 10.1
RATS 10.1

Data Types /

Type Modifiers and Matrix Notation

Home Page

← Previous Next →

Type Modifiers

A type modifier is simply a RATS data type name, or a legal combination of types, enclosed in brackets. Generally, these specify the type of a new variable. For example:

 

COMPUTE [REAL] A = 10


 

They are also used in situations where the intended variable type is not clear from the context, particularly when working with series handles (numbers). For example:


 

dofor i = canusxsr frausxsr jpnusxsr gbrusxsr

   compute base=([series]i)(1996:1)

   set i = 100*(i{0}/base - 1.0)

end dofor i

 

I is an INTEGER "handle" for each series in turn. [SERIES]I forces it to be treated as the SERIES which it represents, so [SERIES](I)(1996:1) is the value at 1996:1 of the series represented by I.


In-Line, or Literal, Matrices

RATS allows you to supply actual array values as part of an expression, using literal matrix notation. To enter a literal matrix, enclose the array elements in pairs of vertical bars ( || ). Separate each element with a comma, and separate rows with a single bar ( | ). For example:
 

COMPUTE [VECTOR[INTEGER]] V = ||1,2,3,4||


creates and sets a 4-element vector of integers.


 


Copyright © 2025 Thomas A. Doan