I am starting to work with SAS and I would like you to please help me resolve the following questions.
How do I transform an imported database from Excel into a matrix?
How can I add a column vector of ones?
It looks like you're using IML - that isn't my forte so I'd suggest you move that to an IML forum.
Here's some short cut references that may help:
https://blogs.sas.com/content/iml/2015/09/28/create-test-matrices.html
If it was a data step it would be:
data want;
do Row_Number=1 to 100;
constant=1;
x=rand('integer', 5, 10);
*create a random number between 5 and 10;
output;
end;
run;
Are you planning to work with SAS/IML or with base programming?
If you're using Base Programming here are some instructions on how to import your data and to create a new column.
Import a CSV file
Import an Excel file
https://video.sas.com/detail/video/4664358166001/using-the-import-data-utility-in-sas-studio
Create a new column
https://video.sas.com/detail/videos/sas-analytics-u/video/4573023399001/creating-a-new-column-in-sas
If you're trying to do this via IML which is more similar to R/Python and matrices/arrays in mathematics, then you would first import your data and then load it into a matrix.
@alix1 wrote:
I am starting to work with SAS and I would like you to please help me resolve the following questions.
How do I transform an imported database from Excel into a matrix?
How can I add a column vector of ones?
It looks like you're using IML - that isn't my forte so I'd suggest you move that to an IML forum.
Here's some short cut references that may help:
https://blogs.sas.com/content/iml/2015/09/28/create-test-matrices.html
If it was a data step it would be:
data want;
do Row_Number=1 to 100;
constant=1;
x=rand('integer', 5, 10);
*create a random number between 5 and 10;
output;
end;
run;
Thank you, your help is very useful.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.