1. Home
  2. VREPLACE procedure

VREPLACE procedure

Replaces values of vectors and pointers (R.W. Payne).

No options


OLDSTRUCTURE = vectors or pointers Variate, factor, text or pointer whose values are to be replaced
NEWSTRUCTURE = vectors or pointers Variate, factor, text or pointer to store the new values; if unset these replace the values in the OLDSTRUCTURE
OLDVALUES = texts, variates or pointers Values to be replaced
NEWVALUES = texts, variates or pointers Replacement values


VREPLACE replaces values in a variate, factor, text or pointer. For texts this differs from the TXREPLACE directive in that it replaces complete lines rather than strings of characters occurring anywhere within the text. It also takes account of restrictions.

The input variate, factor, text or pointer is supplied by the OLDSTRUCTURE parameter. The values to be replaced are specified by the OLDVALUES parameter, and the values to replace them are specified by the NEWVALUES parameter. For variates, texts or pointers, these should also be variates, texts or pointers. For factors, they can be either variates or texts. The NEWSTRUCTURE parameter can supply the identifier of a data structure to store the new values. If this is not set, they replace the values in the OLDSTRUCTURE.

Options: none.

Action with RESTRICT

VREPLACE takes account of restrictions on the OLDTEXT. Restrictions in the other parameters are ignored.

See also

Directives: EDIT, TXREPLACE.
Functions: REPLACE.
Commands for: Calculations and manipulation.


TEXT     [VALUES=hh,a,a,b,b,d,d,e,e,f,f,g,g] t
VREPLACE t; NEWSTRUCTURE=nt; OLDVALUES=!t(a,b,c,d,e,f,g,h);\
VARIATE [VALUES=8,1,1,2,2,4,4,5,5,6,6,7,7] v
VREPLACE v; NEWSTRUCTURE=nv; OLDVALUES=!(1,2,3,4,5,6,7,8);\
POINTER  [VALUES=hh,a,a,b,b,d,d,e,e,f,f,g,g] p
VREPLACE p; NEWSTRUCTURE=np; OLDVALUES=!p(a,b,c,d,e,f,g,h);\
FACTOR   [LABELS=!t(a,b,c,d,e,f,g,hh); VALUES=8,1,1,2,2,4,4,5,5,6,6,7,7] f
VREPLACE f; NEWSTRUCTURE=nf; OLDVALUES=!t(a,b,c,d,e,f,g,hh,x,y,z);\
PRINT    t,nt,v,nv,p,np,f,nf; FIELD=6; DECIMALS=0
Updated on February 14, 2023

Was this article helpful?