Date: Tue, 13 Jul 2004 15:18:56 -0400
Reply-To: sashole@bellsouth.net
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Paul M. Dorfman" <sashole@BELLSOUTH.NET>
Organization: Sashole of Florida
Subject: Re: a simple sas question!
In-Reply-To: <20040713185557.75212.qmail@web53804.mail.yahoo.com>
Content-Type: text/plain; charset="us-ascii"
Assuming your dates are really stored in a character variable, say CDATE,
containing values as you show,
Data subset ;
set being_subset ;
if '15apr2004'd <= input (compress (cdate), date9.) <= '15jun2004'd ;
Run ;
You can also use WHERE clause instead. There can be a myriad variants on
this theme depending on circumstances. Note that it is not a good idea to
store dates like this. You can see why from the fact that if they were
stored as SAS date values, the subsetting line would reduce to
if '15apr2004'd <= cdate <= '15jun2004'd ;
Kind regards,
----------------
Paul M. Dorfman
Jacksonville, FL
----------------
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Behalf Of shimy apoorva
> Sent: Tuesday, July 13, 2004 2:56 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: a simple sas question!
>
> Hi All,
>
> I have this dataset with 17,648 observations. I want to
> create a sub-dataset which have observations from last 2
> months. The date variable has dates in the form - 15 Feb
> 2004, 15 Mar 2004, 15 April 2004, 15 May 2004, 15 jun 2004.
>
> I want to create a sub-dataset which has observations only
> from 15 April to 15 Jun.
>
> Can someone give me a syntax for this.
>
> Thanks in advance!
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
>
|