Date: Sun, 17 Jan 2010 18:59:55 -0500
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: Sequential IDs for multiple obs per subject: Any ideas ? No
dice yet!
Content-Type: text/plain;charset=iso-8859-1
hi ... a small tweak of Tom Abernathy's solution
(from an old posting by Howard Schreier) ...
data raw;
input id age @@;
cards;
1003 6.8611 1003 7.2882
1004 0.1862 1004 0.4271
1005 2.7159 1005 3.2717 1005 3.7892 1005 4.3669
1006 13.8700 1006 14.3573
run;
data new;
set raw;
by id;
seqid+first.id;
run;
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
On Jan 14, 9:53 pm, Yaw <link...@gmail.com> wrote:
> Dear Community:
>
> I still have not able to get the counter to work as sequential id. My
> aim is to have each subject have ID irrespective of the number of
> visits.
>
> My data again is:
>
> input id age;
> datalines;
> 1003 6.8611
> 1003 7.2882
> 1004 0.1862
> 1004 0.4271
> 1005 2.7159
> 1005 3.2717
> 1005 3.7892
> 1005 4.3669
> 1006 13.8700
> 1006 14.3573 ;
>
> I want proc print in this format
>
> id Age SeqID
>
> 1003 6.8611 1
> 1003 7.2882 1
> 1004 0.1862 2
> 1004 0.4271 2
> 1005 2.7159 3
> 1005 3.2717 3
> 1005 3.7892 3
> 1005 4.3669 3
> 1006 13.8700 4
> 1006 14.3573 4
>
> Any Ideas? Thanks!