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)
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
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.