Date: Wed, 18 Apr 2012 15:37:04 +0100
Reply-To: rhian pilling <rhian.pilling@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: rhian pilling <rhian.pilling@GMAIL.COM>
Subject: Re: tracking in SAS - response to previous post
In-Reply-To: <7C3B7F6EBE50184790DF1F026EF7123D12280BA4@RETDAYMBXP003.legal.regn.net>
Content-Type: text/plain; charset=ISO-8859-1
Thank you very much for this!
The assumptions you have noted are correct.
However, the combination that can occur can be anything! It does not have
to be a red red white combination. It can be any combination of the three
classes.
The order or the combination does not matter, so long as for those 3 or
more conseq visits they are not classified as anything other than red,
white or blue for each visit.
BW
On Wed, Apr 18, 2012 at 3:18 PM, Steenhard, David D. (LNG-HBE) <
david.steenhard@lexisnexis.com> wrote:
> I made the assumption here:
> 1) could only have one class per one visit
> 2) visit had to be consecutive numbers
> 3) I allowed for a patient to have more than one Red Red White combination
> (patient 101)
>
> data have;
> input patientnumber visit class $;
> cards;
> 101 1 yellow
> 101 2 red
> 101 3 red
> 101 4 white
> 101 5 green
> 101 6 red
> 101 7 red
> 101 8 white
> 102 1 red
> 102 2 red
> 102 3 white
> 102 4 white
> 102 5 red
> 103 1 red
> 103 2 white
> 103 3 white
> 103 4 white
> 103 5 green
> ;
> proc sort;by patientnumber visit;
> data check(keep=visit patientnumber rename=(visit=_visit));set have;by
> patientnumber;
> l1=lag(class);
> l2=lag2(class);
> if visit=1 then do;l1=' ';l2=' ';end;
> if visit=2 then do;l2=' ';end;
> if class='white' and l1='red' and l2='red';
> proc sql;
> create table want as
> select have.*
> from have
> full join check
> on have.patientnumber=check.patientnumber
> where visit-_visit in(-2,-1,0);
> proc print;run;
>
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>
> David D Steenhard
> Marketing Analytics Manager
> LexisNexis
> Louisville , KY 40245
>
> david.steenhard@lexisnexis.com
> 502-254-2310 Work
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> rhian pilling
> Sent: Wednesday, April 18, 2012 9:40 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: tracking in SAS - response to previous post
>
> Hia,
>
> Sorry I don't yet know how to post back to the list.
>
> I would like all the information for that patient to be put into a
> different data set but only the information corresponding to the visits
> where the conditions are met. So for example
>
>
> patientnumber visit class
> 101 1 yellow
> 101 2 red
> 101 3 red
> 101 4 white
> 101 5 green
>
> here I would like all the information for this patient where the condition
> is met to be put into another dataset as below-
>
> patientnumber visit class
> 101 2 red
> 101 3 red
> 101 4 white
>
> and the conditions where not met ie for visit 5 and 1 to be left.
>
> I hope this makes sense!
>
>
>
> On Wed, Apr 18, 2012 at 2:29 PM, Healy, James P. (Randstad)
> <healjp@jea.com>wrote:
>
> > Are you looking to get all of the various visits from that patient to
> > another dataset, or just to get a dataset that lists IDs that meet your
> > criteria?
> >
> > -----Original Message-----
> > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> anon
> > Sent: Wednesday, April 18, 2012 9:15 AM
> > To: SAS-L@LISTSERV.UGA.EDU
> > Subject: tracking in SAS - response to previous post
> >
> > I recently posted to the list with a query regarding tracking.
> > I am very grateful for the response I had, however the code that I was
> > given does not appear to work.
> >
> > Could anyone suggest anything else that I can try as I know that what I
> > need to do is beyond my capabilities.
> >
> > What I am trying to do is flag and output patients who have been
> > classified (variable name = class) as either red white or blue for 3 OR
> > MORE of their CONSECUTIVE visits (variable = visit)in the trial.
> > for example -
> >
> > patientnumber visit class
> > 101 1 yellow
> > 101 2 red
> > 101 3 red
> > 101 4 white
> > 101 5 green
> >
> > Here I have patient 101 - and in 3 consecutive visits - 2,3 and 4 he has
> > been classified as red red and white. For this reason I want this patient
> > to be flagged and put into another new dataset.
> >
> >
> > The classification in these three or more consecutive visits can be in
> ANY
> > ORDER AND ANY COMBINATION ie blue blue blue, red blue white or red red
> > white (as above!) or blue blue blue red for example AND can occur during
> > any period the patient is in the trial - for example it does not need to
> > occur on the patients first visit or end at their last (above - occured
> at
> > visit
> > 2,3 and 4).
> >
> > can any one help!
> >
> >
> > I have attached the previous code sent - Any help or advice would be
> > appreciated!
> >
> >
> >
> > data want (drop=_:);
> >
> > array _r {1000}; /* Assume <=1,000 record per patient */
> >
> > ** Before starting each patient, initialize "most
> > recent" record for each value of interest and
> > most recent occurrence of any other value **;
> >
> > _mr_red = 0;
> > _mr_white = 0;
> > _mr_blue = 0;
> > _other_mr = 0;
> >
> > do _NR=1 by 1 until (last.patientnumber);
> > set have;
> > by patientnumber;
> >
> > select (class);
> > when ('red') _mr_red=_NR;
> > when ('white') _mr_white=_NR;
> > when ('blue') _mr_blue=_NR;
> > otherwise _other_mr=_NR;
> > end;
> >
> > /* If at least 3 records since an invalid value and every valid value
> has
> > been encountered subsequently then set corresponding array elements
> > */
> >
> > if _other_mr < _NR-2 and _other_mr < min(of _mr_:) then
> > do _I_ = _other_mr+1 to _nr;
> > _r{_I_}=1;
> > end;
> > end;
> >
> > ** re-read and output those flagged in the array **; do _I_=1 to _NR;
> > set have;
> > if _R{_I_}=1 then output;
> > end;
> >
> > run;
> >
> > -----------------------------------------------------------------
> > Florida has a very broad Public Records Law. Virtually all
> > written communications to or from State and Local Officials and
> > employees are public records available to the public and media
> > upon request. JEA does not differentiate between personal and
> > business e-mails. E-mail sent on the JEA system will be
> > considered public and will only be withheld from disclosure if
> > deemed confidential pursuant to State Law. Under Florida law, e-
> > mail addresses are public records. If you do not want your e-
> > mail address released in response to a public-records request,
> > do not send electronic mail to this entity. Instead, contact JEA
> > by phone or in writing.
> >
>
|