Chapter Contents |
Previous |
Next |
Language Reference |
The MATTRIB statement associates printing attributes with matrices. Each matrix can be associated with a ROWNAME= matrix and a COLNAME= matrix, which is used whenever the matrix is printed to label the rows and columns, respectively. The statement is written as the keyword MATTRIB followed by a list of one or more names and attribute associations. It is not necessary to specify all attributes. The attribute associations are applied to the previous name. Thus, the following statement gives a row name RA and a column name CA to A, and a column name CB to B:
mattrib a rowname=ra colname=ca b colname=cb;You cannot group names; although the following statement is valid, it does not associate anything with A:
mattrib a b rowname=n;The values of the associated matrices are not looked up until they are needed. Thus, they need not have values at the time the MATTRIB statement is specified. They can be specified later when the object matrix is printed. The attributes continue to bind with the matrix until reassigned with another MATTRIB statement. To eliminate an attribute, specify EMPTY as the name, for example, ROWNAME=EMPTY. Labels can be up to 40 characters long. Longer labels are truncated. Use the to view current matrix attributes.
An example using the MATTRIB statement follows:
rows='xr1':'xr5'; print rows; ROWS xr1 xr2 xr3 xr4 xr5 cols='cl1':'cl5'; print cols; COLS cl1 cl2 cl3 cl4 cl5 x={1 1 1 1,2 2 2 2,3 3 3 3}; mattrib x rowname=(rows [1:3 ]) colname=(cols [1:4]) label={'matrix,x'} format=5.2; print x; matrix,x cl1 cl2 cl3 cl4 xr1 1.00 1.00 1.00 1.00 xr2 2.00 2.00 2.00 2.00 xr3 3.00 3.00 3.00 3.00
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.