Date: Tue, 9 Sep 2008 07:25:33 -0500
Reply-To: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Subject: Re: KEEP DROP array variables
Content-Type: text/plain; charset=ISO-8859-1
As has been mentioned by someone DROP and KEEP are not executable.
This example uses proc transpose to find all variable that have the
value 5. For just 66 variables but you get the idea.
do id = 1 to 10;
do _n_ = 1 to dim(snps);
snps[_n_] = rantbl(12345,.4,.3,.2,.01,.01,.001);
proc transpose out=t(where=(col1=5));
proc sql noprint;
select distinct(_name_) into :drop separated by ' ' from t;
%put NOTE: DROP=**&drop**;
On 9/8/08, email@example.com <firstname.lastname@example.org> wrote:
> Dear SAS users,
> I know that one cannot use KEEP or DROP with array variables. But is
> there a way to resolve this?
> Here is my code. It doesn't work of course.
> do i=1 to 6651;
> if (snps[i] = "DD") then
> keep snps[i];
> The original dataset has 6651 variables and I only want to keep those
> variables who has values "DD".
> Thank you for the help.