LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (September 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 4 Sep 2001 15:44:50 -0400
Reply-To:     "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject:      Re: Check digits
Comments: To: Dick Campbell <dcamp@UIC.EDU>
Content-Type: text/plain

> From: Dick Campbell [mailto:dcamp@UIC.EDU] > I need to assign check digits to a set of subject id numbers. > Does anyone know of a standard routine in SAS to do this?

you could unload the id-digits into an array and then sum the array:

data CHECKDIGITS; array D(32)4 ;%*creates integer D1, D2, ... D32; *other array mavens will know how to eliminate the load; ChrString = put(ID,32.); do I = 1 to dim(D); D(I) = put(substr(ChrString,I,1),1.); end;

SumOfDigits = sum(of D(*)); %*get the ones digit:; ChkDigit = SumOfDigits - 10*(int(SumOfDigits/10));

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov OpSys: Win_Pro Ver: 8.2 ---> cheerful provider of UNTESTED SAS code from the KludgeWrx !*! <---

By using your intelligence you can sometimes make your problems twice as complicated. -- Ashleigh Brilliant


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