BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
thryce85
Fluorite | Level 6

hows it going?  just started learning iml and was wondering if there is a way to transfer data without having to send the matrix to a dataset .  something along the lines of using a macro  like below .  thanks !

 


proc iml ;
start times( a , b);
x= a*b ;
%let y = x; *totally doesnt work;
print( x ) ;

finish times;
call times(4,5) ;
run;


%put ----------&y ;

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
proc iml ;
start times( a , b);
x= a*b ;
call symputx('y', x);
print( x ) ;

finish times;
call times(4,5) ;
run;


%put ----------&y ;

View solution in original post

4 REPLIES 4
Reeza
Super User
What do you mean by 'transfer data'?
Tom
Super User Tom
Super User

You can use the same function to assign values to macro variables in IML that you would use in a DATA step.  CALL SYMPUTX().

 

https://blogs.sas.com/content/iml/2011/10/17/does-symput-work-in-iml.html

 

PeterClemmensen
Tourmaline | Level 20
proc iml ;
start times( a , b);
x= a*b ;
call symputx('y', x);
print( x ) ;

finish times;
call times(4,5) ;
run;


%put ----------&y ;
PaigeMiller
Diamond | Level 26

@thryce85 wrote:

hows it going?  just started learning iml and was wondering if there is a way to transfer data without having to send the matrix to a dataset .  something along the lines of using a macro  like below .  thanks !

 


proc iml ;
start times( a , b);
x= a*b ;
%let y = x; *totally doesnt work;
print( x ) ;

finish times;
call times(4,5) ;
run;


%put ----------&y ;


Why would you want to switch to macro variables when DATA sets were designed to contain data for later use in SAS? I can see if there's only one value computed by IML that you want to transfer, a macro variable is a pretty simple way. If there is lots of data you want to transfer, macro variables are a very poor choice.

 

Also, you talk about macros, but you do not have macros, you have macro variables. Just for your future understanding and clearness of communications, macros and macro variables are two different things, and macro variables (which you have here) should not be referred to as macros.

--
Paige Miller

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1310 views
  • 6 likes
  • 5 in conversation