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 (December 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 13 Dec 2006 11:16:24 -0500
Reply-To:     Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:      Re: Add suffix

You can fetch the variable names from sashelp.vcolumn, write them to a macro variable ans use proc datasets to do the rename in a loop.

%macro ren(lib=,ds=); %let lib=%upcase(&lib); %let ds= %upcase(&ds); proc sql; create table a as select name from sashelp.vcolumn where libname="&lib" and memname="&ds"; quit; data _null_; set a; call symput("no",_n_); call symput("n"!!compress(put(_n_,8.)),compress(name)); run; proc datasets lib=&lib; modify &ds; rename %do i=1 %to &no; &&n&i = &&n&i.._T %end; ; run; quit; %mend;

%ren(lib=work,ds=c);

Regards, Gerhard

On Wed, 13 Dec 2006 10:40:53 -0500, Ran S <raan67@YAHOO.COM> wrote:

>Hi, > >I have more than 300 variables in the data file and I would like to rename >these varaibles such that I have _T at the end of each variable. How can I >do that in just few steps? > >I would appreciate your help. > >Thank you


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