Statistical programming, matrix languages, and more

get column names in SAS/IML

Reply
New Contributor
Posts: 2

get column names in SAS/IML

HI, I got a matrix. Each column has its own name. How to get the names of the columns and save them into a vector?

for example, how to get the column names in the following matrix?

proc iml;
n = {1 2 3, 4 5 6};      /* 2 x 3 numeric */
c = {'a' 'b', 'c' 'd'};  /* 2 x 2 character */

nNames = "n1":"n3";
cNames = "c1":"c2";
create ndat from n[colname=nNames];
append from n;
create cdat from c[colname=cNames];
append from c;

quit;

Many thanks!

Sincerely,

Ryan

New Contributor
Posts: 2

Re: get column names in SAS/IML

Got it. Use CONTENTS function.

Ask a Question
Discussion stats
  • 1 reply
  • 442 views
  • 0 likes
  • 1 in conversation