| Date: | Thu, 15 Jan 2009 17:35:52 -0500 |
| Reply-To: | Scott Bass <sas_l_739@YAHOO.COM.AU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Scott Bass <sas_l_739@YAHOO.COM.AU> |
| Subject: | Re: Modifying global macro variable set in workspace server
autoexec |
|---|
Hi,
For those who might be interested, this behaviour is a bug. From my
support track:
Here is a snippet from that defect:
"Because the macro variables being created in the autoexec are not showing
up in the GLOBAL symbol table, any subsequent overrides being performed
within the macro end up being created as LOCAL macro variables. If these
were in the GLOBAL symbol table their values would be properly
overwritten.
The result is that the original values are returned when the parm1-parmN
macro variables are resolved later within their code and this means the
customer ends up with incorrect job execution results."
Here is a description of the hot fix problems encountered for this problem
at 9.1.3.
"An attempt was made to back patch the source changes which resolve this
problem in V9.2 into V9.13sp4 and create a V9.13sp4 hotfix. This proved
to be an impossible task due to the many other changes already made to the
V9.2 release at the time the fix for this defect was found. It is
unfortunate that a hot fix for this problem cannot be created."
Bottom line is that this problem is fixed in SAS 9.2, but there is no fix
for it currently in 9.1.3.
This issue is usage noted here: http://support.sas.com/kb/31887
The workaround is to modify the macro variable in open code. Example:
In workspace server autoexec:
%let foo = foo;
In EG or DIS job (or any other client using the workspace server):
%macro test;
%global temp;
%let temp = &foo bar; /* foo resolves at this point, you just can't
change it in the macro. the macro doesn't recognize it as a global macro
variable, so it treats it as local */
%mend;
%test;
%let foo = &temp; /* but you can now change it in your calling code */
%symdel temp / nowarn; /* if you want to delete &temp */
HTH,
Scott
On Mon, 12 Jan 2009 02:48:51 -0500, Scott Bass <sas_l_739@YAHOO.COM.AU>
wrote:
>Hi,
>
>Some test code:
>
>1. In your workspace server autoexec, enter:
>
>%global foo; /* not really needed, already global in scope */
>%let foo=foo;
>
>2. In a client application (i.e. EG or DIS), submit:
>
>%macro test;
> %global foo;
> %let foo = &foo bar;
> %put &foo;
>%mend;
>%test;
>%put &foo;
>
>Your results:
>
>14 %macro test;
>15 %global foo;
>16 %let foo = &foo bar;
>17 %put &foo;
>18 %mend;
>19 %test;
>foo bar
>20 %put &foo;
>foo
>
>Now, start a local SAS session on your remote server machine using the
>exact same command string as your workspace server, and submit the same
>code as above.
>
>This time you get:
>
>1 %macro test;
>2 %global foo;
>3 %let foo = &foo bar;
>4 %put &foo;
>5 %mend;
>6 %test;
>foo bar
>7 %put &foo;
>foo bar
>
>
>Ok, so I can't seem to change the value of a macro variable set in the
>workspace server autoexec.
>
>Questions:
>
>1. Anyone know where this is documented?
>2. Any system option or other technique to get this to work?
>
>Thanks,
>Scott
|