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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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