How do I store the proc iml print statement output in a data set?
data Obs;
do x=0 to 2;
do y=0 to 2;
do z = 0 to 2;
output;
end;
end;
end;
run;
proc iml;
use Obs;
read all var _NUM_ into X;
close Obs;
D = distance(X);
print (D[1:4, 1:4])[format=8.6 c=("Dist1":"Dist4")];
run;
Use the CREATE statement.
Also please use the correct icon so your code if formatted properly.
Why not post it at IML forum ?
data Obs;
do x=0 to 2;
do y=0 to 2;
do z = 0 to 2;
output;
end;
end;
end;
run;
proc iml;
use Obs;
read all var _NUM_ into X;
close Obs;
D = distance(X);
DD=D[1:4, 1:4];
mattrib DD format=8.6 c=("Dist1":"Dist4");
create want from DD;
append from DD;
close;
quit;
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.