Date: Fri, 17 Jun 2005 13:13:38 -0700
Reply-To: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject: Re: "&dat"d does not work in proc sql
Stephan -
It works in v9 XP...hmmm... what's the platform?...how about posting your
log?...have you tried "&dat."d ?
182 options mlogic mprint symbolgen; run;
183 data enroll;
184 startdate='31MAR1998'd;
185 enddate='31MAR2000'd;
186 output;
187 run;
NOTE: The data set WORK.ENROLL has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.59 seconds
cpu time 0.01 seconds
188 %macro dat (dat=);
189 proc sql;
190
191 create table record as
192 select *
193 from enroll
194 where startdate<="&dat"d and enddate>"&dat"d;
195 quit;
196 %mend dat;
197 %dat (dat=31MAR1999);
MLOGIC(DAT): Beginning execution.
MLOGIC(DAT): Parameter DAT has value 31MAR1999
MPRINT(DAT): proc sql;
SYMBOLGEN: Macro variable DAT resolves to 31MAR1999
SYMBOLGEN: Macro variable DAT resolves to 31MAR1999
MPRINT(DAT): create table record as select * from enroll where
startdate<="31MAR1999"d and
enddate>"31MAR1999"d;
NOTE: Table WORK.RECORD created, with 1 rows and 2 columns.
MPRINT(DAT): quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.31 seconds
cpu time 0.04 seconds
MLOGIC(DAT): Ending execution.
hth
Paul Choate
DDS Data Extraction
(916) 654-2160
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Stephan
Chung
Sent: Friday, June 17, 2005 12:44 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: "&dat"d does not work in proc sql
Hello,
When I ran the following sql code, there was an error.
It reads: Incorrect syntax near 'd'
How can I fix the code?
Thanks!
Steve
---------------------------------------
%macro dat (dat=);
proc sql;
create table record as
select *
from enroll
where startdate<="&dat"d and enddate>"&dat"d;
quit;
%mend dat;
%dat (dat=31MAR1999);
-----------------------------------------
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/