|
Shukla,
You can't bulid a macro statement this way - the %global without an ending
; creates problems. There are several ways to approach this.
Simplest is to just generate many %global statements : (I assume you want
to global variables S1p1, S2p2....
%macro test;
%local y;
%do y=1 %to &numcards;
%global Slp&y;
%end;
%mend test;
%test;
If you don't like the idea of all these %global statements, you can build
another macro variable containing all the variable names you want to
global:
%macro test;
%local y names;
%do y=1 %to &numcards;
%let names = &names S1p&y;
%end;
%global &names;
%mend test;
%test;
HTH,
Dennis Diskin
From: Shukla Kshirsagar <shuklak@HOTMAIL.COM>@LISTSERV.UGA.EDU> on
01/03/2003 10:24 AM
Please respond to Shukla Kshirsagar <shuklak@HOTMAIL.COM>
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
To: SAS-L@LISTSERV.UGA.EDU
cc:
Subject: Help with creating global macro variables
Hello everybody,
I need some help with creating some global macro variables. I am using the
following code, and I get attached error
Code:
%macro test;
%global
%do y=1 %to &numcards;
&&Slp&y;
%end;
;;;
%mend test;
%test;
Error:
Macro keyword DO appears as text. A semicolon or other delimiter may be
missing.
5699 &&Slp&y;
5700 %end;
ERROR: There is no matching %DO statement for the %END. This statement will
be ignored.
Any suggestions? Thanks for your help on this and all other questions I
haved posed to the group.
Shukla
|