Date: Thu, 12 Nov 2009 08:59:13 -0600
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Asking for help~~~
Content-Type: text/plain; charset=ISO-8859-1
Are you using these for an analysis of some sort? If so, I suggest doing
this as a view, and/or not doing it at all [you can put a BY variable that
incorporates what you need, usually]. A view would save the storage space
and disk write time while allowing you to subset still.
If you can assume a single record for each date, then this works. However,
your example doesn't list 252 day periods; are they really weekdays or
something? If so you'd need to adjust the number [you can use INTNX with
'WEEKDAY', for example].
if ("&startd"d-252) < date <= ("&startd"d);
This is much faster than creating full datasets, as long as you're not
sending the dataset somewhere else.
Using INTNX for weekdays:
if intnx("WEEKDAY","&startd"d,252) < date <= ("&startd"d);
On Thu, Nov 12, 2009 at 4:18 AM, Stanley Luo <firstname.lastname@example.org> wrote:
> Dear SAS_Ls:
> I want to create several datasets including 252 obs each from an given day
> For example, from 2003/03/26 back to 2002/03/22 then output as dataset,
> from 2003/07/09 back to 2002/07/05 then output as dataset. How do I
> achieve that using macro syntax?
> My original code is shown below
> DATA RDATE;
> SET TWSE_02_07(FIRSTOBS=1 OBS=252);
> WHERE '26MAR03'D >= DATE;
> Thanks in advance!!