Date: Sun, 25 Jul 2010 10:16:56 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Flag obs
Sandy,
I would think that the "look ahead look back" method should provide what
you need to do what you want. See, e.g.:
http://www.sascommunity.org/wiki/Look-Ahead_and_Look-Back
However, your example isn't clear. You only show eight observations, but
talk about obs 9 and 10 as being examples of something.
Also, I don't think that your retain statement is serving any useful
purpose.
Art
---------
On Sun, 25 Jul 2010 15:30:15 +0200, Sandy Plouk <sandy.plouk@GMAIL.COM>
wrote:
>Hi everyone,
>
>From the situation below I would like to achieve the following:
>
>data origin;
>retain pat start end xnb tab;
>informat start end date9.;
>format start end date9.;
>input pat $3. start end xnb tab;
>cards;
>001 15JAN2005 25JAN2005 04 1
>001 26JAN2005 12FEB2005 04 2
>001 15FEB2005 23FEB2005 04 3
>001 01APR2005 12APR2005 05 4
>001 10APR2005 23APR2005 05 4
>002 12JAN2005 21JAN2005 06 1
>002 17JAN2005 24JAN2005 06 2
>002 26JAN2005 12FEB2005 06 1
>;
>
>1.- Create a data set Out_1 where X=1 for an obs where the PAT did not
take
>any TAB for at least 15 days (ex: obs 6)
>2.- Create a data set Out_2 where Y=1 START is less/equal to the previous
>END (ex: obs 7 and 9)
>3.- For a case where, for the same PAT and the same XNB if a subsequent
TAB
>is less than the prev. TAB I would like to create a data set Out_3 where
Z=1
>(ex: obs 10)
>
>Many thanks for your help.
>--
>Kind regards
>Sandy
|