Date: Mon, 25 Apr 2005 20:26:03 -0400
Reply-To: harry.droogendyk@RBC.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Harry Droogendyk <harry.droogendyk@RBC.COM>
Subject: Re: %sysrput macro var not valid macro emission
Content-Type: text/plain; charset="Windows-1252"
This is attempting to be a "function-style" macro. That's why it's invoked from the %put/%let statement, so it will have a context.
Good catch on local %one, it is supposed to be %local_one.
Thinking again about the semi-colons you raised. A semi-colon on the %local_one invocation causes %local_two to fail, removing the semi-colon gets me what I want. But, see below for the rsubmited version, ain't so hopeful, even with the semi-colon removed from %one ( and a comment added as Kevin suggested ).
It appears that SAS is incapable of separating the %one macro statement from the 'endrsubmit' statement unless the semi-colon is specified. Any ideas?
3048 %global var;
3049 %macro local_one;
3050 %let var = 4;
3051 %mend;
3052
3053 %macro local_two; %* colon after macro call;
3054 %local_one;
3055 &var
3056 %mend;
3057
3058 %put %nrstr(%local_two) returns %local_two;
%local_two returns
NOTE: Line generated by the macro variable "VAR".
1 4
-
180
MPRINT(LOCAL_TWO): 4
ERROR 180-322: Statement is not valid or it is used out of proper order.
3027 %put %nrstr(%local_two) returns %local_two;
%local_two returns 4
3028 %global var;
3029 %macro local_one;
3030 %let var = 4;
3031 %mend;
3032
3033 %macro local_two; %* no colon after macro call;
3034 %local_one
3035 &var
3036 %mend;
3037
3038 %put %nrstr(%local_two) returns %local_two;
%local_two returns 4
=======================================
Remote submitted ( still not working ):
=======================================
3063 rsubmit;
NOTE: Remote submit to _SERVER_ commencing.
648 options mprint;
649 %macro one;
650 %sysrput remote_var = 4;
651 %mend one;
NOTE: Remote submit to _SERVER_ complete.
3064
3065 %macro two;
3066 ; %* need this semi-colon before the RSUBMIT, why? ;
3067 rsubmit;
3068 %one
3069 %*;
3070 endrsubmit;
3071 %put Inside %nrstr(%two &remote_var) has a value of &remote_var;
3072 &remote_var
3073 %mend two;
3074
3075 %put Result of %nrstr(%two) is %two;
Result of %two is
MPRINT(TWO): rsubmit
NOTE: Remote submit to _SERVER_ commencing.
MPRINT(TWO): ; %one endrsubmit;
WARNING: Apparent symbolic reference REMOTE_VAR not resolved.
Inside %two &remote_var has a value of &remote_var
652 %one endrsubmit;
653 &remote_var;
654 %put %nrstr(&remote_var) is &remote_var;
NOTE: Remote submit to _SERVER_ complete.
MPRINT(TWO): &remote_var
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of
Kevin Roland Viel
Sent: Monday, April 25, 2005 5:15 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: %sysrput macro var not valid macro emission
Harry,
That is interesting. I wonder what might happen if you tried to call
the macro with something between it and the ENDRSUBMIT statement such as a
comment.
I looked again at your original macro:
%macro two;
; %* need this semi-colon before the RSUBMIT, why? ;
rsubmit;
%one;
endrsubmit;
%put Inside %nrstr(%two &remote_var) has a value of &remote_var;
&remote_var
^^^^^^^^^^^
%mend two;
The four is laying about for a good reason. My initial thoughts were
wrong because it is apparently a global macro variable, which should have
been obvious because the macro variable and not the value would have been
laying about. The value "4" is laying about because the macro variable
resolves amid nothing (no data set or procedure) by virtue
of the underlined portion about. There is a good chance that you have
provided this as a bare example and I have misinterpreted it.
I also looked at your local example again:
2539 %global var;
2540 %macro local_one;
2541 %let var = 4;
2542 %mend;
2543
2544 %macro local_two;
2545 %one;
^^^^
2546 &var
2547 %mend;
2548
2549 %put %nrstr(%local_two) returns %local_two;
%local_two returns 4
LOCAL_TWO calls ONE, not LOCAL_ONE. There is no indication from the log
that the macro ONE does not exist, though.
I hope I have not missed too much this time :)
Regards,
Kevin
Kevin Viel
Department of Epidemiology
Rollins School of Public Health
Emory University
Atlanta, GA 30322
__________________________________________________________________________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations.
Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized.
If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite.
Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.