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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 502 views
  • 6 likes
  • 5 in conversation