Date: Wed, 10 Oct 2007 16:55:53 -0000
Reply-To: "shaunak.adgaonkar@gmail.com" <shaunak.adgaonkar@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "shaunak.adgaonkar@gmail.com" <shaunak.adgaonkar@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: scrambling of digits
In-Reply-To: <1191975905.444029.19500@g4g2000hsf.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
one more solution ... this time perfect one
data assign1;
input no1 $ account $;
datalines;
12456780 V
34211234 SC
34561230 A
09231828 V
;
run;
data assin2;
set assign1;
if account='V' then ;
a=substr(no1,5,2);
b=compress(no1,a);
c=substr(b,5,2);
d=substr(b,1,4);
e=substr(b,7,2);
f=translate(a,'3516480927','1234567890');
g=trim(d)||trim(f)||trim(e);
/* g is your desired thing for account type V*/
if account='SC' then;
a1=substr(no1,1,4);
b1=substr(no1,5,4);
c1=translate(b1,'3516480927','1234567890');
d=trim(a1)||trim(c1);
/* d is your desired thing for account type SC*/
if account ne 'V' or account ne 'SC' then
a1=substr(no1,1,5);
b1=substr(no1,8,1);
c1=substr(no1,6,2);
d1=translate(c1,'3516480927','1234567890');
e1=trim(a1)||trim(d1)||trim(c1);
/* e1 is your desired thing for other account types */
run;
lemme know if you have doubts
|