How to assign column names to a matrix permanently

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

How to assign column names to a matrix permanently

Hello to whoever can help

 

the program I have is as following 

Capture1.PNG

when run 

                       print mu_vec[colname=assetNames];

it give me:

Capture.PNG

when I run 

                 print mu_vec

it gives me

 

Capture.PNG

this is not what I want.

 

What I want is that when I run program, print mu_vec;

it will give me

Capture.PNGso how should insert colnames into mu_vec instead of doing mu_vec[colname=assetNames] every time.

 

thank you?


Accepted Solutions
Solution
‎01-24-2016 09:50 PM
Super User
Posts: 9,878

Re: How to assign column names to a matrix permanently

Hoho, It is IML question, plz post it at SAS/IML Software and Matrix Computations

 

 

proc iml;
assetNames={"MSFT" "NORD" "SBUX"};
mu_vec={0.042 0.0015 0.028};
mattrib mu_vec c=assetNames;
print mu_vec;

quit;

View solution in original post


All Replies
Solution
‎01-24-2016 09:50 PM
Super User
Posts: 9,878

Re: How to assign column names to a matrix permanently

Hoho, It is IML question, plz post it at SAS/IML Software and Matrix Computations

 

 

proc iml;
assetNames={"MSFT" "NORD" "SBUX"};
mu_vec={0.042 0.0015 0.028};
mattrib mu_vec c=assetNames;
print mu_vec;

quit;
Contributor
Posts: 31

Re: How to assign column names to a matrix permanently

Thank you @Ksharp !

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 262 views
  • 1 like
  • 2 in conversation