Date: Fri, 22 Feb 2002 00:05:17 +0000
Reply-To: Puddin' Man <pudding_man@POSTMARK.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Puddin' Man <pudding_man@POSTMARK.NET>
Subject: Re: Encrypting a field in the SAS file!
Content-Type: text/plain; charset="iso-8859-1"
If one defines encryption rigorously, one _might_ need to
consider a 'strength of encryption' scale of, perhaps,
0-100, where 0 is un-encrypted and 100 is the strongest
encryption on the planet.
You have not given us enought info to choose from such
a scale. All we can do is conjecture ...
You did, however request "an easy way to encrypt ...".
The following will emphasize "easy".
Suppose I needed to make a SAS dataset with a proprietary
name field available to a group of users. Suppose further
that I wanted to make the name field unrecognizable and
I was _absolutely_ certain none of the users would attempt
to decrypt such a field unless the means to do so "Jumped
Up And Smacked Them In The Face" <g>.
Suppose even further that all characters in the name field
consisted of the low-case alphabet, the period, and the space
(28 chars total):
astr=' .abcdefghijklmnopqrstuvwxyz';
If I build a second string by
merely exchanging the positions of some/all of the
pairs of characters in the first string, I can use the
TRANSLATE function to very-weakly-encrypt the name field.
The following (tested W2k SAS 8.1) briefly illustrates
a simplification of this approach:
475 data v8.encrypt;
476 astr=' .abcdefghijklmnopqrstuvwxyz';
477 estr=reverse(substr(astr,15,14)) ||
reverse(substr(astr,1,14));
478 run;
NOTE: The data set V8.ENCRYPT has 1 observations and 2 variables.
NOTE: DATA statement used:
real time 0.02 seconds
cpu time 0.02 seconds
479
480 data e(keep=encrypted);
481 input name &:$20.;
482 if _n_=1 then set v8.encrypt;
483 encrypted=translate(name,estr,astr);
484 decrypted=translate(encrypted,astr,estr);
485 put (name encrypted decrypted) ($22.);
486 cards;
john lee williamson ojqkzmttzbpmmpxlfjkz john lee williamson
big joe williams wprzojtzbpmmpxlfzzzz big joe williams
robert m. nighthawk gjwtgezlyzkprqeqxbnz robert m. nighthawk
henry townsend qtkg.zejbkftkuzzzzzz henry townsend
Perhaps you can use something like this? I don't know that
you are likely to find anything "easier" ...
Zalut,
Puddin'
*******************************************************
*** Puddin' Man *** Pudding_Man@postmark.net *****
*******************************************************;
" ... who bared their brains to Heaven under the El and saw
Mohammedan angels staggering on tenement roofs illuminated ..."
- from "Howl ...", Allen Ginsberg, maybe 1957
----------------------------------------------------------------
I am looking for an easy way to encrypt a field in my sas file.
This is an
ID field with the width of 12 bytes.
Any help would be appreciated. The id field is alpha/numeric.
Example: A09876547800
D00540096540
000000000 (a SS#)
Thanks.
Rashida Patwa