turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2015 10:11 AM

data a;

input investor $ y;

cards;

fdcd1 0.006157039

fdcd2 0.001510721

fdcd3 0.35458659

fdcd4 -0.04071315

fdcd5 -0.01494467

fdcd6 -0.009

run;

The matrix is like this( Note: the colname of matrix is a mess of vector. Their orders are different). How to give their Product? Thanks!

fdcd1 fdcd3 fdcd2 fdcd5 fdcd4 fdcd6

0.79 0.01 1.09 3.75 0.82 0.43

1.4 0.23 0.86 0.88 1.44 1.19

0 0 0 0 0 0

0 0.09 0 0 0 0.02

0.33 0 0 0 0.33 0.29

0.28 0 0 0 0.27 0.42

0 0 0 0 0 0

0 0 0 0 0 0.04

0 0 0 0 0 0

0.14 0.19 0 0 0.14 0.1

0 0 0 0 0 0

0.19 0 0 0 0.19 0.17

0 0 0 0 0 0

0.12 0.1 0 0 0.12 0.15

0 0 0 0 0 0.06

0 0 0 0 0 0

0.1 0 0 0 0.1 0.09

Accepted Solutions

Solution

02-02-2015
10:41 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2015 10:41 AM

It looks like you want the product of the matrix (in the second part) with the vector (in the first part). The problem you are having is that the columns of the matrix are not in the same order as the elements in the vector.

Read in the investors and the y vector from data set A. Then use the INVESTORS vector to specify the order of the variables when you read the matrix, which I assume is in a data set named M:

proc iml;

use a;

read all var {investor y};

close a;

use m;

read all var investor into X; /* read variables in order contained in INVESTOR */

close m;

v = X*y; /* matrix-vector product */

print v;

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2015 10:26 AM

Normally I think of the "matrix product" as the multiplication of two (or more) matrices, but you only seem to have one matrix. Could you explain further what you want?

Solution

02-02-2015
10:41 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2015 10:41 AM

It looks like you want the product of the matrix (in the second part) with the vector (in the first part). The problem you are having is that the columns of the matrix are not in the same order as the elements in the vector.

Read in the investors and the y vector from data set A. Then use the INVESTORS vector to specify the order of the variables when you read the matrix, which I assume is in a data set named M:

proc iml;

use a;

read all var {investor y};

close a;

use m;

read all var investor into X; /* read variables in order contained in INVESTOR */

close m;

v = X*y; /* matrix-vector product */

print v;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-04-2015 10:24 AM

Thanks for your help.