From the helpful post: Writing data from a matrix to a SAS data set - The DO Loop
It shows to make a dataset from vectors with the var statement.
proc iml;
/** create SAS data set from vectors **/
y = {1,0,3,2,0,3}; /** 6 x 1 vector **/
z = {8,7,6,5,6}; /** 5 x 1 vector **/
c = {A A A B B B}; /** 1 x 6 character vector **/
create MyData var {y z c}; /** create data set **/
append; /** write data in vectors **/
close MyData; /** close the data set **/
And from a matrix with the from statement.
proc iml;
/** create SAS data set from a matrix **/
x = {1 2 3,
4 5 6,
7 8 9,
3 2 1 }; /** 4 x 3 matrix **/
create MyData2 from x[colname={"q" "r" "s"}];
append from x;
close MyData2;
Say I have 2 vectors with dimensions, 5x1, and a matrix size 5 x 5. What is the best way combine or just utilize one of these approaches to get a SAS dataset with 5 records and 7 columns? Thanks!