I have been using SAS/IML for few months now. I would like to use different sets of data to undertake some calculations related to Experimental Designs, the only way I am aware of is to import the data from an excel file to be then read into arrays in sas/iml. This way of importing data is making some of the calculations very hard.
Does anyone know the different ways of setting the data to be used particularly in SAS/IML.
I want to save different sets of data in files and call them into SAS/IML. Is that possible?
Thanks for your reply.
I had hope that using a different method to import data will make some calculations easier to tackle.
Right now, first I have to import the data from excel then read and assign each column to an array separately. Is there a way to put the whole data set in a matrix at once?
Thank you very much.
I managed to read all the variables into a matrix however I had to read the numerical _NUM_ and character _CHAR_ variables separately even though I tried using _ALL_ to print all variable into one matrix but its not working. Are you aware of any reasons that can cause such a problem?
Also, is it possible to read the headings of the columns from excel as well?
Character variables and numeric variables need to be in separate matrices. In PROC IML, you have to refer to a matrix by its matrix name, I don't think you can refer to specific columns by some other name. So maybe most of the data goes into one matrix, and another part of the data goes into a different matrix, allowing you to have somewhat meaningful matrix names.
You can change the way matrices are display, to have meaningful column names, but that only affect the display of the matrices and not calculations done with the matrices. https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=imlug&docsetTarget=imlug_...
For an overview, see "Reading ALL variables INTO a matrix."
Paige said, "I don't think you can refer to specific columns by some other name," but that is not actually correct. You can access rows or columns of a matrix by names. However, maybe what Paige meant is that this feature is not always useful in complex programs, which is an opinion that I agree with.
Registration is open! SAS is returning 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. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.