Date: Fri, 10 Aug 2007 10:05:44 +1000
Reply-To: d@dkvj.biz
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Johnson <d@DKVJ.BIZ>
Subject: Re: macro for purging specified variables
In-Reply-To: <689151C56427594B91B8B67C68BF5FA8014865EB@EXCHANGEMAIL.AD.UCOP.EDU>
Content-Type: text/plain; charset="us-ascii"
I presume you will assign directories to libraries before executing this
process Matthew.
You will also need to do some research on the data set columns to make sure
you get all variations of the problematic columns. This may not be a
trivial task.
I do think though that unless the libraries you are using are copies of your
primary source libraries, then you will run into trouble. Permanently
dropping columns is not something you can readily undo. I would approach
this by writing the macro to copy the data, with columns dropped, to a
"Ready to share" library so that my original data was not lost, and I had a
library that had been empty before the process and now contains only data
that has been cleaned for the sharing process.
Kind regards
David
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of
Matthew Yurdin
Sent: Friday, 10 August 2007 2:38 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: macro for purging specified variables
Does anyone have some code for searching through a number of specified
libraries/directories for SAS datasets containing certain specified
variables and then dropping all those variables from the datasets? The
idea here to get rid of personally-identifiable information when that
information can go by many different name variations and may or may not
found in a large number of datasets spread throughout many different
directories.
So I'm imagining something like...
%macro purgeids(libslist=temp1 temp2 temp3 temp4 temp5 etc,
/* libraries in which to search for datasets with any vars in &varlist
*/
varslist=ssn socsecno social_security_number
birthdate bdate bday /* variables to look for in every dataset in
&libslist. If it finds anything from &varslist, it will re-save the
dataset with the same name but without the variable(s) */
);
/* ??????? */
%mend purgeids;
Thanks
-Matt