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
In-Reply-To: <d49ff16d-6135-4f46-b631-9ff779286da0@a3g2000prm.googlegroups.com>
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.
data have;
array snps[66];
do id = 1 to 10;
do _n_ = 1 to dim(snps);
snps[_n_] = rantbl(12345,.4,.3,.2,.01,.01,.001);
end;
output;
end;
run;
proc transpose out=t(where=(col1=5));
by id;
var snps:;
run;
*proc print;
run;
%let drop=;
proc sql noprint;
select distinct(_name_) into :drop separated by ' ' from t;
quit;
run;
%put NOTE: DROP=**&drop**;
On 9/8/08, jlee8071@gmail.com <jlee8071@gmail.com> 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
> do;
> keep snps[i];
> end;
> end;
>
> The original dataset has 6651 variables and I only want to keep those
> variables who has values "DD".
>
> Thank you for the help.
> claus
>
|