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 (March 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 17 Mar 2006 17:52:40 GMT
Reply-To:   Roger Lustig <trovato@VERIZON.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Roger Lustig <trovato@VERIZON.NET>
Subject:   Re: Couple of Issues - Leading Zeros/Incrementing a Counter
Comments:   To: sas-l@uga.edu
In-Reply-To:   <1142616007.946535.86470@p10g2000cwp.googlegroups.com>
Content-Type:   text/plain; charset=us-ascii; format=flowed

You need to format the numeric part with leading zeroes.

FinalvisitNum='EF'||put(VisitNum,z10.) ;

should do that.

As for incrementing, try this:

data new; set old; by name notsorted; * <--- NOTSORTED may not be necessary; if _N_=1 then FinalVisitNum=0; else if first.name then FinalVisitNum + 1; <etc>

OK?

Roger

The_Grudge wrote:

> Sorry everyone, this will be my last post today....promise! > > I need to create a uniqueID with a format like this - "EF0000000000" > So 2 characters followed by 10 numbers. > > Also, I need to increment this data as I go, so it may look something > like this in the end: > > David EF0000000000 > David EF0000000000 > Jeff EF0000000001 > Mark EF0000000002 > > > I am having 2 issues. > > 1) Whenever I write the statment to join "EF" to my number, the leading > zeros disappear. Here is my code: > > Format VisitNum Z10.; > > VisitNum = 0000000000; > FinalVisitNum = "EF" || VisitNum; > > 2) Whenever I try to increment the number nothing happens....I prob > just need a RETAIN" statement, but I've been out of SAS for 2 yrs and > I'm just coming back....sorta lost =) >


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