Advertisement
Guest User

Untitled

a guest
May 29th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. proc iml ;
  2. /* Define a scalar */
  3. scalar=5;
  4.  
  5. /* Define a vector */
  6. /* row vector */
  7. row_vec={1 2 3 4 5 6};
  8.  
  9. /* column vector */
  10. col_vec={1, 2, 3, 4, 5, 6};
  11.  
  12. /* Define a (2 x 3) matrix */
  13. num_mat={1 2 3, 4 5 6};
  14. chr_mat={'Hello,', 'world! :D'};
  15.  
  16. /* identity matrix */
  17. i_mat=I(6);
  18.  
  19. /* column vector with repeated entries, 2 */
  20. mat_2=repeat(2, 3);
  21.  
  22. /* transpose the vector vr */
  23. trow_vec=row_vec`;
  24.  
  25. /* reshape the vector row_vec to a (3 x 2) matrix */
  26. mat1=shape(trow_vec, 3, 2);
  27.  
  28. /* Print the output */
  29. print scalar, row_vec, col_vec, num_mat, chr_mat, i_mat, mat_2, trow_vec,
  30. mat1;
  31.  
  32. /* Store the variables to the workspace */
  33. store scalar row_vec col_vec num_mat chr_mat i_mat mat_2 trow_vec mat1;
  34. quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement