Date: Thu, 18 Aug 2011 11:07:15 -0700
Reply-To: Mark Miller <mdhmiller@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mark Miller <mdhmiller@GMAIL.COM>
Subject: Re: Is there a way to create variable containing the pdv?
In-Reply-To: <201108181754.p7IAlHOG030270@willow.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Art,
Put the keep list in a macro variable.
Activate it in the ds option and a var assignment.
e.g.
%LET keeplist = a y z ;
...data test (keep = &keeplist kept)
...
kept = "&keeplist" ;
...mark miller
On 8/18/2011 10:54 AM, Arthur Tabachneck wrote:
> Suppose you had the following program:
>
> data test(keep=a y z);
> input a b c x y;
> z=y+5;
> cards;
> 1 2 3 4 5
> ;
>
> Is there a way, from within the datastep, to create a variable that contains
> the names of all of the variables that are in the pdv. Thus, in the above
> example, say a variable called variables that would have the value:
> "a b c x y z"? And, similarly, create another variable that has the names of
> the variables in the keep statement (i.e., in this case, a variable called
> kept with the value "a y z")?
>
> Thanks in advance,
> Art
|