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 (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 1 Sep 2006 16:23:45 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: Select column names based on the column values
In-Reply-To:  <8B5E9B95CC245C46A68BF4495A29A7EEB3C35C@chpdm-mail.chpdm.umbc.edu>
Content-Type: text/plain; format=flowed

Sekhar ,

I will offer a slightly different perspective here in so much as I dont like writing macros when I feel one isnt needed and I especially hate macros that among other things have no parameters.

So here is my humble non-macro solution:

Data Test ; Input Col1 Col2 Col3 ; Cards; 23 40 30 -100 30 40 25 -100 35 ; Run ;

ODS Listing Close ; ODS Output OneWayFreqs = Freqs ;

Proc Freq Data = Test ; Table _Numeric_ ; Run ;

ODS Listing ;

Data VarNames ( Keep = VarNames ) ; Length VarNames $ 200 ; Set Freqs ; By Table ;

If ( First.Table And ( VValueX( Scan( Table , 2 , ' ' ) ) = -100 ) ) ;

VarNames = Scan( Table , 2 , ' ' ) ;

Run ;

Proc SQL NoPrint ; Select VarNames Into: Vars Separated By ',' From VarNames ;

Create Table New As Select &Vars From Test ; Quit ;

Proc Print Data = New ; Run ;

Toby Dunn

When everything is coming at you all at once, your in the wrong lane.

A truly happy person is someone who can smile and enjoy the scenery on a detour.

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sekhar Sent: Friday, September 01, 2006 10:40 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Select column names based on the column values

Hi How can I select the coulmn names based on the column values. For example col1 col2 col3 23 40 30 -100 30 40 25 -100 35

In this I want to select all the column names having minimum value of -100. can I use sashelp.vcolumn.

Thanks for the help.


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