|
<< Click to Display Table of Contents >> RENAME |
![]() ![]()
|
RENAME changes names of variables inside a databank. If the rename operation involves two different databanks, the variable is moved between the banks (and possibly also renamed, as in for instance rename b1:x as b2:y; between the two databanks b1 and b2).
Note that 'naked' wildcards are allowed in this statement, so you may for instance use a*b?c as wildcard instead of the more cumbersome {'a*b?c'}.
rename < BANK=... > variables1 AS variables2;
BANK= |
(Optional). A databank name indicating where the timeseries are located. |
variables1 |
Variable name(s) or list(s) |
variables2 |
Variable name(s) or list(s) |
•If a databank name is not provided, the variable is not searched for in other databanks than the first-position databank.
•Looping: with a list like for instance #m = a, b;, you may use rename x{#m} to y{#m}; to rename xa to ya, and xb to yb.
Consider the two series x1 and x2 residing in the first-position databank. If we want to rename those series into y1 and y2, we could use:
rename x1, x2 as y1, y2; |
Lists can be used instead:
#a = x1, x2; //or: ('x1', 'x2') |
Rename works across banks, too, in reality moving the variable:
rename b1:x as b2:x; //moving between banks |
Wildcards can be used like this:
rename x*2 as y_*; |
All variables starting with x and ending with 2 will obtain prefix y_.
See the similar COPY statement for more examples. RENAME is in reality similar to a COPY where the original object is deleted after copying. Also see the INDEX statement and the wildcard page regarding the syntax rules of wildcards.
When using two lists of names, the lists must have equal length.
If preferred, you may use rename ... to ... instead of rename ... as ... .
RENAME does not accept array-series indexes yet, but you may use COPY followed by DELETE to the same effect.