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.
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.
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.
Thanks!
What I needed to do was
hstar[100000*(i-1)+j] = hhat[100000*(i-1)+j];
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.