BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
x2PSx
Calcite | Level 5

Hello,

 

I am trying to multiply a matrix and a vector with proc iml, but I never used it,.

 

Basically, I already have the two datasets that I need, one MATRIX and one VECTOR.

 

I simply want the resulting vector of the multiplication of MATRIX*VECTOR in a new dataset with one variable named RESULT.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Better post is at IML forum, since it is a IML question.

 

data matrix;
 set sashelp.class;
 keep age weight height;
run;
data vector;
 do vector=1 to 3;
  output;
 end;
run;

proc iml;
use matrix;
read all var _num_ into matrix;
close;
use vector;
read all var {vector};
close;

result=matrix*vector;

create result var {result};
append;
close;
quit;

View solution in original post

3 REPLIES 3
TomKari
Onyx | Level 15

Here's an introductory resource to PROC IML that I hope you'll find helpful. Rick also publishes "The DO Loop" blog for SAS.

 

http://support.sas.com/resources/papers/proceedings13/144-2013.pdf

 

In the future, I suggest you post IML questions to the Analytics / SAS/IML area. The Enterprise Guide area tends to get questions about the EG interface, and the IML folks don't tend to watch it.

 

Tom

x2PSx
Calcite | Level 5
Thank you, will do!
Ksharp
Super User

Better post is at IML forum, since it is a IML question.

 

data matrix;
 set sashelp.class;
 keep age weight height;
run;
data vector;
 do vector=1 to 3;
  output;
 end;
run;

proc iml;
use matrix;
read all var _num_ into matrix;
close;
use vector;
read all var {vector};
close;

result=matrix*vector;

create result var {result};
append;
close;
quit;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2513 views
  • 0 likes
  • 3 in conversation