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 11:41:55 -0400
Reply-To:     Jack Clark <JClark@CHPDM.UMBC.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Clark <JClark@CHPDM.UMBC.EDU>
Subject:      Re: Select column names based on the column values
Comments: To: Sekhar <ckalisetty@GMAIL.COM>
Content-Type: text/plain

Sekhar,

My understanding is that you want the column name from any variable that has a value of -100 as the minimum value in the column. If the assumption is not correct, you should be able to change the HAVING clause to accommodate your needs...

data test; input col1 col2 col3; cards; 23 40 30 -100 30 40 25 -100 35 ; run;

proc sql noprint; select count(*),name into :vcnt, :vnames separated by ' ' from dictionary.columns where libname='WORK' and memname='TEST' ; quit;

%put &vcnt; %put &vnames;

%macro chkmin;

%do i = 1 %to &vcnt;

proc sql; %if &i = 1 %then %do; create table keepcols (col_name char(20)); %end; insert into keepcols select "%scan(&vnames,&i)" as col_name from test where %scan(&vnames,&i) <= -100 ; quit;

%end;

proc print data = keepcols; run;

%mend chkmin;

%chkmin;

Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County

-----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