Command Reference : Function Reference : Function Reference: U
  
 
@upper
Uppercase representation of string or upper triangular matrix of a matrix.
String
Syntax: @upper(str)
str: string
Return: string
Returns the uppercase representation of the string str.
Matrix
Syntax: @upper(x[, n])
x: matrix, sym
n (optional) integer
Return: matrix
Returns a matrix whose elements on and above the n-th diagonal match the corresponding elements of the matrix m, but whose elements below the n-th diagonal are zero.
By default, n is has a value of zero indicating the main diagonal. Positive values of n indicate super-diagonals, while negative values of k indicate sub-diagonals.
Examples
String
If we define the string object
string s1 = "I did NOT do it"
the commands
@upper("I did NOT do it")
@upper(s1)
return the string “I DID NOT DO IT”.
If ALPHA1 is an alpha series,
alpha alphalwr = @upper(alpha1)
returns the upper of the strings in ALPHA1 for each observation in the workfile sample.
If SVEC1 is an string vector,
svector sveclen = @upper(svec1)
returns a string vector containing the uppercased elements of SVEC1.
Matrix
The commands
matrix(3,3) m1
m1.fill 1, 2, 3, 4, 5, 6, 7, 8, 9
matrix u1 = @upper(m1)
matrix u2 = @upper(m1, 1)
matrix u3 = @upper(m1, -1)
create a matrix M1 holding the values
while the matrix U1 contains,
the matrix U2 contains,
and the matrix U3 contains,
If we have the commands,
sym s = @rwish(@identity(5), 5)
matrix s1 = @upper(s)
matrix s2 = @upper(s, 1)
matrix s2 = @upper(s, 1)
then S is a sym matrix and S1 is a upper triangular matrix with elements at or above the main diagonal equal to those in S, and elements below the main diagonal equal to zero. S2 is a strictly upper triangular matrix that is equal to S1, but with the main diagonal elements also set to 0.
Cross-references
See also @lower.