BookmarkSubscribeRSS Feed
kilasue
Calcite | Level 5

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}.

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

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?

IanWakeling
Barite | Level 11

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;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Multiple Linear Regression in SAS

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 3 replies
  • 891 views
  • 3 likes
  • 4 in conversation