Date: Sun, 17 Jan 2010 12:06:23 -0500
Reply-To: SAS user <sasuser4@GOOGLEMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: SAS user <sasuser4@GOOGLEMAIL.COM>
Subject: Re: Creating a new dataset-beg/end dates
Thank you for the reply.
What I want to do is to be able to create a list of observations for each
year based on beg and end dates. So for example for id 10020 I want to
have an indicator/variable to designate that this observation is included
in an index in 1957, 1958....and 2008. I 'm looking for the most efficient
way to accomplish this considering that each observation is likely to be
in an index for many years and at the end I would like to have a list of
observations included in the index for each year.
On Sun, 17 Jan 2010 11:24:45 -0500, Arthur Tabachneck
<art297@NETSCAPE.NET> wrote:
>In order to answer your question the list probably needs more information
>about what you are trying to do. If it is simply to select based on Beg
>and End, you might already have the variables you need. E.g.:
>
>data have;
> informat Beg yymmdd8.;
> informat End yymmdd8.;
> format Beg date9.;
> format End date9.;
> input ID Beg End;
> cards;
>10007 19570301 19840718
>10008 19570301 20070214
>10009 19580604 19760630
>10020 19570301 20081231
>;
>
>data want;
> set have (where=(Beg<='01MAR1957'd<=End));
>run;
>
>HTH,
>Art
>--------
>On Sun, 17 Jan 2010 08:28:47 -0500, SAS user <sasuser4@GOOGLEMAIL.COM>
>wrote:
>
>>Hello
>>
>>Below is a sample of my data
>>
>>ID Beg End
>>10007 19570301 19840718
>>10008 19570301 20070214
>>10009 19580604 19760630
>>10020 19570301 20081231
>>
>>The objective is to create a dataset which will allow me to identify the
>>IDs which were included in the dataset as identified by the end variable.
>>
>>For example for ID 10020 I want to have a variable that will enable me to
>>identify that this ID was in the dataset in 1957, 1958, 1959.... till
>>12/2008.
>>
>>Any suggestions would be most welcome.
>>
>>Thanks!
|