LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: sas-l@uga.edu
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


Back to: Top of message | Previous page | Main SAS-L page