Date: Tue, 22 Nov 2011 16:29:31 -0500
Reply-To: sas quest <sasquest@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: sas quest <sasquest@GMAIL.COM>
Subject: Re: Flagging at visit
In-Reply-To: <CAOVa6wpJ8Y=G0-2DjPV3s-KHCS-i7JWX3KcKK7tUst=OMWGSmA@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Thanks Yu, it worked.
On Tue, Nov 22, 2011 at 4:27 PM, Yu Zhang <zhangyu05@gmail.com> wrote:
> I misread your sample "Want " output. this should do it.
>
>
> proc sql;
> select pt, visit,'Not Done' as new_stat
> from have
>
> group by 1,2
> having sum(upcase(status)='NOT DONE')=count(*);
> quit;
>
> On Tue, Nov 22, 2011 at 3:16 PM, sas quest <sasquest@gmail.com> wrote:
>
> > Thank you for responding.
> > I Cannot use proc sql based solution for some strange reason. But your
> > solution is not showing the right patients.
> >
> >
> > On Tue, Nov 22, 2011 at 4:09 PM, Yu Zhang <zhangyu05@gmail.com> wrote:
> >
> > > Is it close what you are looking for?
> > >
> > > Yu
> > >
> > >
> > > proc sql;
> > > select pt, visit,'Not Done' as new_stat
> > > from have
> > >
> > > group by 1,2
> > > having sum(upcase(status)='NOT DONE')>1;
> > > quit;
> > >
> > >
> > >
> > > On Tue, Nov 22, 2011 at 2:43 PM, sas quest <sasquest@gmail.com> wrote:
> > >
> > >> Hi,
> > >>
> > >> I have a dataset like this
> > >>
> > >> data have;
> > >> input pt visit test $ status $8.;
> > >> cards;
> > >> 100 1 A Not Done
> > >> 100 1 B Not Done
> > >> 100 1 C Done
> > >> 100 1 D
> > >> 100 2 A Not Done
> > >> 100 2 B Done
> > >> 101 1 A Not Done
> > >> 101 1 B Not Done
> > >> 101 1 C Not Done
> > >> 102 1 A
> > >> 102 1 B Done
> > >> 102 1 C Not Done
> > >> 103 1 A Not Done
> > >> 103 1 B Not Done
> > >> 104 1 A
> > >> 104 1 B Done
> > >> 105 2 A Not Done
> > >> 106 1 A
> > >> ;
> > >> run;
> > >>
> > >> I need to identify pt=101, 103 and 105 where Status='Not Done' within
> a
> > >> vist . For some reason Proc SQL cannot be used.
> > >>
> > >> Want:
> > >> 101 1 Not Done
> > >> 103 1 Not Done
> > >> 105 2 Not Done
> > >>
> > >> Thanks in advance.
> > >>
> > >
> > >
> >
>
|