BookmarkSubscribeRSS Feed
Mike_Davis
Fluorite | Level 6


Hello Everyone!

I have a problem to create a macro in local for running a remote code: method 1 works well,but method 2 doesn't work. what is the problem with method 2??

Thanks!

Mike

rsubmit;

data  z;

x=123;

run;

endrsubmit;

method 1:/*create remote macro,this method works well*/

rsubmit;

%macro mm;

data _null_;

set z;

call symputx('aaa',x);

run;

%put &aaa;

%mend mm;

%mm; /*this will show 123 in the log*/

endrsubmit;

method 2:/*create a local macro*/


%macro mm2;
rsubmit;
data _null_;
set z;
call symputx('bbb',x);
run;
%put &bbb;
endrsubmit;
%mend mm2;

%mm2; /*This will not work ,why?*/

4 REPLIES 4
Mike_Davis
Fluorite | Level 6

To simply the question like this:

rsubmit;
%let aaa=123456;

endrsubmit;

/***********************************************/

rsubmit;

%put &aaa;/*this works*/

endrsubmit;

/**********************************************************/

%macro kk;
rsubmit;
%put &aaa;
endrsubmit;
%mend kk;
%kk;/*This doesn't work*/

Thanks!

Jay_TxOAG
Quartz | Level 8

Thanks for that...I always wondered why I coudn't assign a macro in my remote session

Mike_Davis
Fluorite | Level 6

%macro mm2;

 

%nrstr(

rsubmit;

data _null_;

set z;

call symputx('bbb',x);

run;

%put &bbb;

endrsubmit;

);

%mend mm2; 

%mm2;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 846 views
  • 0 likes
  • 2 in conversation