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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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