Hello.
I want to read a dataset with two columns into proc iml, but it only prints one column when I print it.
Can someone tell me what I am doing wrong please?
proc iml; use data.lossdata; read all var {lob loss} into A[colname = varNames]; print A; quit;
You can read the variables into vectors:
read all var {lob loss};
For more information about reading numeric and character variables, see
These two variables have the same type ? both are numeric or character ?
The lob is a character and loss numeric.
@Ksharp has diagnosed the problem correctly, as matrices are either all character or all numeric. Whenever you run code, it is always good to check the SAS log for messages, as I suspect you have missed a warning message about a type missmatch.
Also check the recent thread on this forum called "Matrix with strings in IML", in particular the link that Rick gives to the Table structure.
You can read the variables into vectors:
read all var {lob loss};
For more information about reading numeric and character variables, see
Thank you all.
I appreciate the help.
There is still a lot to learn.
Yes, there is always more to learn, but to get started you might try some of the tips at "Ten tips for learning the SAS/IML language", especially the SAS Global Forum paper "Getting Started with the SAS/IML Language" (Wicklin 2013)
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.