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 (April 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 23 Apr 2007 17:39:23 -0400
Reply-To:     Nathaniel.Wooding@DOM.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <Nathaniel.Wooding@DOM.COM>
Subject:      Re: Is there a short expression for variables ended with the same
              letter
Comments: To: Suhong Tong <sophidt@HOTMAIL.COM>
In-Reply-To:  <BAY109-F14C0D1E766D1BB50FF2995B24B0@phx.gbl>
Content-type: text/plain; charset=US-ASCII

Sophia

I had to play around with the functions a bit. Others may work also but this one does. SQL is not my strong suite so I am never sure what works and what doesn't.

Nat

data SCHLID; retain q1-q11 5 q1x q2x q3x q4x q5x 10; run;

proc sql noprint; select name into :DropList separated ' ' from dictionary.columns where libname eq 'WORK' and memname eq 'SCHLID' and index(name,'x'); ; quit; run;

data _null_; put "string = &droplist"; run;

Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977

Suhong Tong <sophidt@HOTMAIL. COM> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-L@LISTSERV.U GA.EDU> Subject Re: Is there a short expression for variables ended with the same 04/23/2007 05:19 letter PM

Please respond to Suhong Tong <sophidt@HOTMAIL. COM>

That's exactly my problem. My real variable name is like q1-q96 and q1x-q96x. tried a SQL code like this:

proc sql noprint; select name into :DropList separated ' ' from dictionary.columns where libname eq 'WORK' and memname eq "SCHLID" and SUBSTR(name, -1, 1)='X'; ; quit; run;

data reduced; set SCHLID; drop &droplist; run;

and certainly SUBSTR(name, -1, 1)='X' is not the right function to extract the last letter.

Any advise?

Thanks,

Sophia

>From: Nathaniel.Wooding@dom.com >To: Sophia Tong <sophiDT@HOTMAIL.COM> >Subject: Re: Is there a short expression for variables ended with the same > letter >Date: Mon, 23 Apr 2007 17:05:54 -0400 > >q: is what I would use but that assumes that you do not have any variables >starting with q that you want to keep. > >Nat Wooding >Environmental Specialist III >Dominion, Environmental Biology >4111 Castlewood Rd >Richmond, VA 23234 >Phone:804-271-5313, Fax: 804-271-2977 > > > > Sophia Tong > <sophiDT@HOTMAIL. > COM> To > Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU > Discussion" cc > <SAS-L@LISTSERV.U > GA.EDU> Subject > Is there a short expression for > variables ended with the same > 04/23/2007 04:59 letter > PM > > > Please respond to > Sophia Tong > <sophiDT@HOTMAIL. > COM> > > > > > > >Dear list experts, > >I have a data set with variables q1-qn and q1x-qnx. I want drop q1x-qnx, >and don't want type them one by one, is there something similar to q1-qn or >q: that I can use? > >Thanks, > >Sophia > > > >----------------------------------------- >CONFIDENTIALITY NOTICE: This electronic message contains >information which may be legally confidential and/or privileged and >does not in any case represent a firm ENERGY COMMODITY bid or offer >relating thereto which binds the sender without an additional >express written confirmation to that effect. The information is >intended solely for the individual or entity named above and access >by anyone else is unauthorized. If you are not the intended >recipient, any disclosure, copying, distribution, or use of the >contents of this information is prohibited and may be unlawful. If >you have received this electronic transmission in error, please >reply immediately to the sender that you have received the message >in error, and delete it. Thank you. >

_________________________________________________________________ Mortgage refinance is Hot. *Terms. Get a 5.375%* fix rate. Check savings https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h2bbb&disc=y&vers=925&s=4056&p=5117


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