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 ;
proc iml ;
start times( a , b);
x= a*b ;
call symputx('y', x);
print( x ) ;
finish times;
call times(4,5) ;
run;
%put ----------&y ;
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
proc iml ;
start times( a , b);
x= a*b ;
call symputx('y', x);
print( x ) ;
finish times;
call times(4,5) ;
run;
%put ----------&y ;
@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.
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 25. Read more here about why you should contribute and what is in it for you!
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.