Date: Sun, 24 Feb 2008 14:48:23 -0800
Reply-To: shanky <shankardasm@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: shanky <shankardasm@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: SAS: create unique record number
Content-Type: text/plain; charset=ISO-8859-1
Hi Keith,
You could try something like this:
proc sort;by bandnum species year month day;
run;
data test1;
set test;
by bandnum species year month day;
if first.year then count=1;
else count+1;
run;
data test2(drop=count x);
set test1;
if count<10 then x=compress('9'||put(year,best8.)||'000'||
put(count,best8.));
else if 10<=count<100 then x=compress('9'||put(year,best8.)||'00'||
put(count,best8.));
else x=compress('9'||put(year,best8.)||'0'||put(count,best8.));
bandnum=input(x,best12.);
run;
Hope this helps;
Shanky
|