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
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
|