BookmarkSubscribeRSS Feed
manojkuchi
Calcite | Level 5

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;

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Use the CREATE statement.

See here and here.

 

Also please use the correct icon so your code if formatted properly.

Ksharp
Super User

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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1172 views
  • 0 likes
  • 3 in conversation