|
The suggestion by both Jaack Shoemaker and Bernard Tremblay to use if
first.pat_id then pat_num+1; doesn't work for some reason.
(I think Joe forgot the retain statement, but I tried it both ways and
neither worked)/
All I get is a vector of ones! :(
Although I could use the _n_ option, I'd like to nail this programming
issue because it will be useful to know.
anyone?
Lea
In article <62AAE2DBEFD3D211841A0008C74568010150F2D4@EXCHANGE>,
Jack Shoemaker <JShoemaker@ACCORDANT.NET> wrote:
> Lea,
>
> I think you're looking for this:
>
> data two;
> set oneb;
> by pat_id;
> if first.pat_id then pat_num + 1;
> run;
>
> --
> Jack N Shoemaker / JShoemaker@Accordant.net
> Visit our patient communities at http://www.accordant.com or our
corporate
> site http://www.accordant.net
>
> -----Original Message-----
> From: leamw@MY-DEJA.COM [mailto:leamw@MY-DEJA.COM]
> Sent: Wednesday, August 23, 2000 2:54 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: newbie Retain question
>
> Hi:
>
> I know I'm doing something wrong here.. I just can't figure out what.
>
> I have a list of patient identifiers that are coded
alphanumericallly.
> I need them to be numeric. I thought that what I'd do is to just
simply
> number them from 1 to n using a retain and a sum statement like this:
>
> data two;
> set oneb;
> by pat_id;
> pat_num=1;
>
> retain pat_num 1;
> if first.pat_id then do;
> pat_num=sum(pat_num,1);
> end;
> run;
>
> Of course all I get is the value of 2 for pat_num.
> I have tried to replace the if statement with
> things like: if pat_num ne 0 then do;
> but this doesn't work either
>
> What am I doing wrong?
>
> Thanks
>
> Lea
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
|