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

05-06-2012 04:29 AM

I have the following code:

proc iml;

use prepped;

read all;

hstar = j(200000,1,.);

do i = 1 to 2;

do j = 1 to 6;

hstar[100000*(i-1)+j] = hhat;

end;

end;

quit;

The line that reads

hstar[100000*(i-1)+j] = hhat;

gives the following error:

ERROR: (execution) Matrices do not conform to the operation.

operation : [ at line 124 column 9

operands: HSTAR, _TEM1003, HHAT

HSTAR 200000 rows 1 col (numeric)

_TEM1003 1 row 1 col (numeric)

HHAT 200000 rows 1 col (numeric)

statement: ASSIGN at line 124 column 4

Can anybody help with this?

Thanks.

Accepted Solutions

Solution

05-06-2012
05:25 AM

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

05-06-2012 05:25 AM

For each value of i and j, hstar[100000*(i-1)+j] is a scalarl value.

However, hhat is a vector with 200,000 rows. You can't assign a vector to a scalar.

If you describe what you're trying to achieve, someone could help further.

All Replies

Solution

05-06-2012
05:25 AM

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

05-06-2012 05:25 AM

For each value of i and j, hstar[100000*(i-1)+j] is a scalarl value.

However, hhat is a vector with 200,000 rows. You can't assign a vector to a scalar.

If you describe what you're trying to achieve, someone could help further.

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

05-06-2012 05:39 AM

Thanks!

What I needed to do was

hstar[100000*(i-1)+j] = hhat[100000*(i-1)+j];