LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 24 Jun 2003 07:40:06 -0700
Reply-To:   Xavier Autret <xav_x@NOOS.FR>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Xavier Autret <xav_x@NOOS.FR>
Organization:   http://groups.google.com/
Subject:   Re: vname, assigning character variable to itself
Content-Type:   text/plain; charset=ISO-8859-1

add a trim to mtrm==>

if upcase(substr(left(temp),1,4))="MRTM" then mtrm = trim(mtrm) || ' ' || vname(vars(i));

You can also use SCL function in datastep (look after functions: open, attrn, varname, close). or the SASHELP.VCOLUMN view. or ODS with proc contents or proc contents...

Xavier

Janis.Jekabsons@dresdner-bank.com (Janis Jekabsons) wrote in message news:<f6ed644e.0306240241.16875a34@posting.google.com>... > Hi group, > > I would like to get the names of all variables ending in "MTRM" using > something like this: > > data _null_; > set &_pricedat; > length mtrm $200.; > mtrm=''; > if _n_=1 then do; > array vars(*) _numeric_; > do i=1 to dim(vars); > temp=reverse(vname(vars(i))); > put temp=; > if upcase(substr(left(temp),1,4))="MRTM" then mtrm = mtrm || ' ' > || vname(vars(i)); > put mtrm= ; > end; > call symput('mtrm',mtrm); > end; > if _n_ ge 1 then stop; > run; > > %put MTMR = &MTRM; > > The weak point appears to be the assignment > mtrm = mtrm || ' ' || vname(vars(i)); > > MTRM comes back empty, even though the decision (upcase ..) works. > > How can I do this? I am probably missing something quite simple ... > > Regards, > > Janis Jekabsons


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