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 (November 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 10 Nov 2000 13:09:19 -0500
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: How to convert all variable names into upper cases?
Comments: To: Victor Kamensky <kamensky@AECOM.YU.EDU>
Content-Type: text/plain; charset="iso-8859-1"


Just put

options validvarname = upcase ;

in your autoexec. This will probably solve any problems with needing upper case names. If you really need to change the names of an existing data set then I would suggest modifying your macro to use PROC DATASETS to do the renaming, since there is no need to copy data just to rename variables. In this case be sure that

options validvarname = v7 ;

during the renaming process.

Ian Whitlock <>

-----Original Message----- From: Victor Kamensky [mailto:kamensky@AECOM.YU.EDU] Sent: Friday, November 10, 2000 12:36 PM To: SAS-L@LISTSERV.UGA.EDU Subject: How to convert all variable names into upper cases?

Hi,SAS-L-ers! a). The problem. (V8). Variable names can be in uppercase and in lowercase. Sometimes alphabetical order in proc contents is desired. How to convert all variable names into upper cases? b) My quick tested solution:

%macro upvar(dataset); proc contents noprint data=&dataset out=_c_(keep=name);run; %let nobs=0; data _c_; set _c_; length upname $ 32; upname=upcase(name); if upname^=name; call symput('nobs','1'); run; %if &nobs > 0 %then %do ; data _null_; set _c_ end=last; if _N_=1 then call execute("data &dataset; set &dataset; rename"); call execute(name||'='||upname); if last then call execute("; run;"); run; %end; %mend upvar;

c) I understand my solution is old-fashioned. Surely someone can come with a modern solution. But will it be simpler? Or (and) shorter? Victor Kamensky Programmer Albert Einstein College of Medicine

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