Date: Fri, 9 Sep 2011 11:26:56 -0400
Reply-To: sas quest <sasquest@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: sas quest <sasquest@GMAIL.COM>
Subject: taking long time to run
Content-Type: text/plain; charset=ISO-8859-1
Hi ,
Following is the code iam using
%let dat1 = intnx(month,"&endate"d,-6);
%let cutoff=%sysfunc(&dat1,date9.);
*
PROC* *SQL*;
CREATE TABLE WORK.a1 AS
SELECT DISTINCT y.pid
FROM lib1.data1 x INNER JOIN WORK.data2 y ON (x.pid = y.pid)
WHERE x.var1= 'Y' AND datepart(x.var2) >= *"&cutoff"d* AND datepart(x.var2)
< *"&endate"d*
ORDER BY y.pid;
*
QUIT*;
It is taking close to 2 hours to run if iam running the above code. If i
replace the macro variables (cutoff,endate) by real date values
(ex:21JAN2003) it is running very fast.
How to make the above code run faster?
Thanks,
|