Date: Tue, 9 Sep 2008 09:22:12 -0700
Reply-To: snoopy369 <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: snoopy369 <snoopy369@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: KEEP DROP array variables
Content-Type: text/plain; charset=ISO-8859-1
On Sep 9, 10:53 am, Akshaya <akshaya.nathil...@gmail.com> wrote:
> My bad, I didn't test the code before posted it. I know the MV's
> created using Call Symput routine can't be referred back in the same
> data step, since it's a run time stmt. Thinking abt a different
> approach, thanks Gerhard for pointing it out.
>
> Thanks!
> Akshaya
Your method could work, actually, but a bit different, I think, using
a whole lot of macro variables. Not exactly macro-efficient, but it
should still work (unless there's a macro variable number limit?)
data old; set old;
do i=1 to 6651;
if (snps[i] = "DD") then do;
call symput(cats('keep',i),vname(snps[i])); /*
Assign the
variable name which satisfies the condition to a MV /*
else call symput(cats('keep',i)," ");
end;
end;
run;
%macro keepmacro;
%do i = 1 %to 6651;
&&&keep&i;
%end;
%mend keepmacro;
data has;
set old;
keep %keepmacro;
run;
|