In IML, following code gives an error:
proc iml; i=5; theta={i*3,4}; quit;
This code has no error. But it doesn't run as expected:
proc iml; i=5; j=i*3; theta={j,4}; quit;
What's the reason?
I want to create a column with elements {15,4}.
No, I don't think the syntax is supported like that. Also, I think the second block of code is much prettier, so why not just go with that?
The reason it runs without error is that IML interprets { j , 4 } as a declaration of a character vector. The easiest way to get what you want is to use a concatenation operator:
theta = j // 4;
To expand on Ian's answer, see the article "How to build a vector from expressions."
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates