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 (October 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 16 Oct 2009 15:27:22 -0500
Reply-To:     Joe Matise <snoopy369@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Matise <snoopy369@GMAIL.COM>
Subject:      Re: Generating line of variable names
Comments: To: Andrew.Clapson@statcan.gc.ca
In-Reply-To:  <F433BF18D811E745B79191E749A6DAF10151EF99@stcem16.statcan.ca>
Content-Type: text/plain; charset=ISO-8859-1

PROC CONTENTS with the OUT= option, or one of the dictionary tables: proc sql; create table test as select * from dictionary.columns where libname='WORK'; run; to see what's available, or proc sql; select name into :namelist separated by ' ' from dictionary.columns where libname='WORK' and memname="&DSNAME"; quit; puts it in a macro variable you can use as: %put &namelist; as well as into the output window.

You can limit it in the WHERE statement to drop out undesired column names.

Not sure about assigning to a function key.

-Joe

On Fri, Oct 16, 2009 at 2:45 PM, Andrew Clapson < Andrew.Clapson@statcan.gc.ca> wrote:

> Hey all, > > In the process of sifting through variables in a data set I'm working on > - one for which someone decided to use rather cumbersome variable names > - I thought how much easier it would be to simply paste a spaced line of > the different variable names, and then just delete the ones that I want > to drop (or keep, as the case may be). > > Is there any way to get SAS to print a line of variable names for a > given dataset? > Some variant of a PROC CONTENTS perhaps? > Even better would be assigning this process to a function key (via a > recorded macro, maybe?), to print the full list of variables at a > keystroke for a KEEP, DROP, or RETAIN command. > > Any thoughts? > > > Andy Clapson >


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