Working with Matrices

Scalars

Scalars are matrices that have only one element. You define a scalar with the matrix name on the left side of an assignment statement and its value on the right side. You can use the following statements to create and display several examples of scalar literals. First, you must invoke the IML procedure.

  
    >  proc iml; 
  
       IML Ready 
  
    >  x=12; 
    >  y=12.34; 
    >  z=.; 
    >  a='Hello'; 
    >  b="Hi there"; 
    >  print x y z a b; 
  
                   X          Y          Z  A      B 
                  12      12.34          .  Hello  Hi there
 
Notice that, when defining a character literal, you need to use either single quotes (') or double quotes ("). Using quotes preserves uppercase and lowercase distinctions and embedded blanks. It is also always correct to enclose the data values within braces ({ }).

Previous Page | Next Page | Top of Page