Date: Fri, 1 May 2009 09:20:53 -0500
Reply-To: "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: how to upcase varible names in dataset
Content-Type: text/plain; charset=ISO-8859-1
On 5/1/09, Ed Heaton <email@example.com> wrote:
> My final comment is the rhetorical question "Why would you want to make
> your variable names more difficult to read by upper-casing them?"
Exactly! Why do you want this?
However assuming the OP really wants to do this and did not mean "how
to I upcase all the VALUES of the character variables?", it should be
noted that the META data method propose using PROC DATASETS needs a
small qualification. The rename statement in PROC DATASETS works
differently than you might expect.
changes the name of a variable in the data set specified in the MODIFY
statement. old-name must be a variable that already exists in the data
set. new-name cannot be the name of a variable that already exists in
the data set or the name of an index, and the new name must be a valid
Therefore if a variable already exists "D" and you try to rename to
"D" you get an error.
58914 data low;
58915 retain a b c D;
58917 call missing(of _all_);
58919 proc datasets nolist;
58920 modify low;
58921 rename d=D;
ERROR: Variable D already exists on file WORK.LOW.
If you are willing to recreate the data set using a data step then the
VALIDVARNAME option could be useful alternative to the RETAIN method
proposed by Ed..
retain a b c D;
call missing(of _all_);
proc contents data=low;