| Date: | Mon, 19 Oct 2009 21:54:20 -0400 |
| Reply-To: | Sigurd Hermansen <HERMANS1@WESTAT.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Sigurd Hermansen <HERMANS1@WESTAT.COM> |
| Subject: | Re: Generating line of variable names |
|
| In-Reply-To: | <F433BF18D811E745B79191E749A6DAF10151EF99@stcem16.statcan.ca> |
| Content-Type: | text/plain; charset="us-ascii" |
Andy:
If you go way back in the excellent SAS-L archives you will find a SAS Macro that I wrote, very similar to SAS Macros that others have written, that selects SAS variable names from DICTIONARY.columns into a comma-delimited list and assigns the list to a SAS macrovariable that will expand in a SAS program. More recently I've tended to use the SAS data option DELETE when I have to subset a large and cumbersome list of variables.
S
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Andrew Clapson
Sent: Friday, October 16, 2009 3:46 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Generating line of variable names
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
|