Date: Thu, 16 Sep 2010 15:46:57 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Arithmetic with dates in PROC SQL
Content-Type: text/plain; charset="us-ascii"
As you know, anything in between the paretheses
for the FROM CONNECTION TO has to be the syntax
that goes with the environment being run in.
i.e. the "pass-through" code which is all the
code in between the parens must be DB2 syntax,
and everything outside the parens is SAS syntax.
So you would be heading to your IBM DB2 manuals
for date functions or date literal operators.
WHERE DATE BETWEEN (&FROM - 7 DAYS)
AND (&TO + 7 DAYS)
See QMF section of DB2 date handling:
Hope this is helpful.
Investment Business Intelligence
Investment Management & Research
Global Leaders in Multi-Manager Investing
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Thursday, September 16, 2010 2:35 PM
Subject: Arithmetic with dates in PROC SQL
I'm guessing this question has probably come up before, but I haven't
been able to find an answer. I'm using the following macro variables in
a proc sql step to pull all records in a certain date range:
%LET FROM = '2010-05-01';
%LET TO = '2010-05-31';
CONNECT TO DB2 (DSN=... UID=... PWD=...);
CREATE TABLE MYDATA AS SELECT * FROM CONNECTION TO DB2
WHERE DATE BETWEEN &FROM AND &TO
What I'd like to do is be able to expand my date range by 7 days in
either direction by using something like
WHERE DATE BETWEEN (&FROM-7) AND (&TO+7)
This doesn't seem to work - any ideas on how to do this?
Empire BlueCross BlueShield
Business Information Analyst II
165 Broadway, 14th Floor
New York, NY 10006
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
and privileged information or otherwise protected by law. Any
review, use, disclosure or distribution is prohibited. If you are not
intended recipient, please contact the sender by reply e-mail and
all copies of the original message.