LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 18 Aug 2011 12:13:02 -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?
Comments:   To: Mike Rhoads <RHOADSM1@WESTAT.COM>
In-Reply-To:   <D47ACC3DC1D6CA4D85DE61DC39DA319F062F1234@EX10MAIL2.westat.com>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

Mike,

That was my point. My example is the extreme case when NO variables from the input data appear in the output; but it isn't completely unlikely.

What's in the output : datastep created variables

... mark

On 8/18/2011 12:03 PM, Mike Rhoads wrote: > Even beyond Mark's example, the premise seems invalid to me. You might need a variable from the input data set as a resource, e.g. part of an expression to create a derived variable, without needing to carry it onto the output data set. > > Mike Rhoads > RhoadsM1@Westat.com > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Mark Miller > Sent: Thursday, August 18, 2011 2:51 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Is there a way to create variable containing the pdv? > > Art, > > Regarding the scenario described > { given a datastep, which variables are listed on the keep option of a set statement, but aren't listed on the keep option of the data statement, thus could be > removed from the keep option of the set statement. } > > What if NONE of vars on keep option of DATA > appear in keep option of SET ?? > Like where everything in output is created in datastep from vars in SET or from code ? > > ...mark > > On 8/18/2011 11:30 AM, Arthur Tabachneck wrote: >> Mark, >> >> I was thinking about how I would go about addressing a question that I >> saw on the SAS Forum, namely given a datastep, which variables are >> listed on the keep option of a set statement, but aren't listed on the >> keep option of the data statement, thus could be removed from the keep >> option of the set statement. >> >> Yes, of course I know how to use put or putlog to see a list of what >> is in the pdv, but I've never tried to grab and analyze it. >> >> Put another way, how would one incorporate the results of, say, a put >> _all_ into a variable? >> >> Thus, my question, is: without having to change one's code to >> incorporate macro variables that contain the information, can it be >> done programmatically by just analyzing one's program. >> >> Art >> ------- >> On Thu, 18 Aug 2011 11:18:15 -0700, Mark Miller<mdhmiller@GMAIL.COM> wrote: >> >>> Art, >>> >>> I already commented on the outgoing var list. >>> >>> As for the content of the current PDV, you know there are many ways >>> to get the var list as that topic gets discussed here every month. >>> >>> Suppose you create a macro var named myPDV. >>> Then you assign it to a datastep var PDVnow. >>> What do you do with it? >>> Do you want the list to include PDVnow. >>> >>> ... 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


Back to: Top of message | Previous page | Main SAS-L page