Accesses attributes of structures.
||Which attributes to access (
||Structures whose attributes are to be accessed|
||Pointer to store copies of the attributes of each structure; these are labelled by the
GETATTRIBUTE directive lets you access attributes of each of the structures that are listed with its
STRUCTURE parameter. It refers to the list of structures by pointers, which are set up by the
SAVE parameter. You must always set the option and both parameters.
If you request an attribute that is not relevant to a structure, it is omitted from the pointer. Thus for example the
labels settings are relevant only for factors, and
ncolumns only for matrices. The references to those attributes that you do specify are always stored in the order shown in the definition of the
ATTRIBUTE option at the beginning of this subsection.
For attributes that are single numbers, the information is copied into an unnamed scalar which is pointed to by the appropriate element of the pointer; if the attribute has not been set, then the corresponding scalar will contains a missing value. For the attributes
tsmodel, the corresponding element of the pointer is a text structure containing a single line. For the other attributes, the corresponding element of the pointer stores a reference to the attribute itself. One example is the labels vector of a factor. However, if the factor has no labels vector the corresponding entry of the pointer is set to the missing value.
type setting gives a scalar value indicating the type of structure, by the code:
6 diagonal matrix
7 symmetric matrix
stype setting supplies the type name in a text structure. This works not only for the standard Genstat types, such as variates and factors, but also for user-defined types (see
Commands for: Data structures.
" Examples 1:2.11.3a-c " VARIATE [VALUES=1,2,*,4] X GETATTRIBUTE [ATTRIBUTE=nvalues,nmv] X; P PRINT P VARIATE [VALUES=4,8,12] Lev FACTOR [LEVELS=Lev] F GETATTRIBUTE [ATTRIBUTE=levels,labels] F; P DUMP [PRINT=attributes,values] P,Lev STRUCTURE [NAME='complex number'] 'real','imaginary'; TYPE='scalar' DECLARE [TYPE='complex number'] C; VALUES=!p(3,2) FACTOR F TEXT T VARIATE V GETATTRIBUTE [ATTRIBUTE=stype] C,F,T,V; SAVE=Typec,Typef,Typet,Typev PRINT Typec,Typef,Typet,Typev