Date: Wed, 20 Aug 2008 14:43:39 -0400
Reply-To: Bucher Scott <SBucher@SCHOOLS.NYC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bucher Scott <SBucher@SCHOOLS.NYC.GOV>
Subject: Re: macro variable generated by Proc SQL
In-Reply-To: A<5fe63d3a-238e-4360-b546-0a1a020eb5a8@z72g2000hsb.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Are you running %PUT _USER_; inside the macro? Unless otherwise
declared, the scope of the variables will be local, i.e. will not exist
once the macro they are in stops running.
-Scott
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
adjmost@COMCAST.NET
Sent: Wednesday, August 20, 2008 2:27 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: macro variable generated by Proc SQL
Hi,
I'm having some trouble with generating macro variables from a SQL
procedure.
I've done that in the past and never had problems, however here I'm
adding a couple of layers of complexity and there must be something
I'm doing wrong.
Here's how the code looks like, the macro variables &id, &i and &&id&i
have been defined in a previous step and a %PUT _USER_ statement shows
they exists and are correctly defined. the macro variables that are
giving me problems are those in the "into" part of the code.
%macro chartdata;
%do i=1 %to &tot;
proc sql;
select min(date) as mindate, max(date)as maxdate, (select dos from
chartdata_&&id&i where l=1) as lastdos
into :first_&&id&i, :last_&&id&i, :lastdos_&&id&i
from chartdata_&&id&i
;
quit;
run;
%end;
%mend chartdata;
%chartdata;
When I run
%PUT _USER_;
I don't see any of the variables that were supposed to be created in
the Proc SQL step.
Any ideas? Is there a limit on how many macro variables SAS can
create?
Thanks,
G
|