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

 

%macro new;

options mprint mlogic;

OPTIONS COMAMID = TCP;

%LET _host_user=xxxx;

%let _host_pass=xxxx;

%LET Rsysv = rysa 7280;

signon Rsysv  user="&_host_user" password="&_host_pass" noscript;

 

rsubmit;

 
data new;

x=5;

run;

 

data _null_;

call symputx('y',2);

run;

 

%if &y=2 %then %do;

proc download data=new;

run;

%end;

 

endrsubmit;

 

%mend;

 

%new



 

 

how can i use below condition correctly in remote session 

 

%if &y=2 %then %do;

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

You should enter the %IF into a internal macro submitted to the remote host:

%macro new;
options mprint mlogic;
OPTIONS COMAMID = TCP;
%LET _host_user=xxxx;
%let _host_pass=xxxx;
%LET Rsysv = rysa 7280;
signon Rsysv  user="&_host_user" password="&_host_pass" noscript;

rsubmit;
 
data new;
x=5;
run;
 
data _null_;
call symputx('y',2);
run;

%macro check(arg);
    %if &arg=2 %then %do;
      proc download data=new;
     run;
%end; %mend check; %check(&y); endrsubmit; %mend; %new;

View solution in original post

3 REPLIES 3
Shmuel
Garnet | Level 18

You should enter the %IF into a internal macro submitted to the remote host:

%macro new;
options mprint mlogic;
OPTIONS COMAMID = TCP;
%LET _host_user=xxxx;
%let _host_pass=xxxx;
%LET Rsysv = rysa 7280;
signon Rsysv  user="&_host_user" password="&_host_pass" noscript;

rsubmit;
 
data new;
x=5;
run;
 
data _null_;
call symputx('y',2);
run;

%macro check(arg);
    %if &arg=2 %then %do;
      proc download data=new;
     run;
%end; %mend check; %check(&y); endrsubmit; %mend; %new;
Shmuel
Garnet | Level 18
You should consider any code between RSUBMIT and ENDRSUBMIT as a separate program, You probably know that %IF should be part of a macro known to host where it is running.
Reeza
Super User
If you're using SAS 9.4 TS1M5 that type of code is valid, but it's not in earlier versions. You need to have another external macro that you can call with the %IF logic.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 3 replies
  • 575 views
  • 0 likes
  • 3 in conversation