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 (January 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 29 Dec 2009 13:47:10 -0800
Reply-To:   Frank DiIorio <frankdiiorio@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Frank DiIorio <frankdiiorio@GMAIL.COM>
Organization:   http://groups.google.com
Subject:   Re: Keep only variables with specific characters
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On Dec 29, 4:40 pm, STran <st.t...@gmail.com> wrote: > Hi, > I have a dataset full of coded variables. I would like to create a new > dataset from the original, pulling out only variables that contain a > specific string of characters in them. In this case, the specific > string of characters is at the end of the variable name. > > data_have variables: > c1fpop1 > c2fpop2 > c3fpop3 > ... > c1mpop1 > c2mpop2 > c3mpop3 > ... > > data_want variables (all those containing "fpop"): > c1fpop1 > c2fpop2 > c3fpop3 > ... > > Thanks for your help. > Sarah

Untested:

proc sql noprint; select name into :nameList separated by ' ' from dictionary.columns where upcase(memname) = 'DATA_HAVE' & index(upcase(name), 'FPOP') > 0 ; create table data_want as select &nameList. from data_have ; quit;


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