Date: Tue, 1 Jul 2008 13:28:17 -0500
Reply-To: Mary <mlhoward@avalon.net>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Proc SQL- use of "as" brings along the old label!
Content-Type: text/plain; charset="iso-8859-1"
I just ran across an unexpected result in Proc SQL; if I attempt to use the "as" to create a new name, then if there is a label attached to it, it retains the old label! Example:
data test;
informat old_name $20.;
infile cards;
input old_name $;
label old_name= 'old_name';
cards;
name1
name2
name3
;
proc sql;
create table newtest as
select old_name as new_name
from test;
quit;
run;
In this case the variable "newname" in newtest has the label "old_name". It might be something to watch out for, especially since ODS does assign labels to many of its variables automatically. At first in looking at the data I was thinking that it was not changing the name for me, but upon looking at the attributes, it was changing the name, but when I looked at the data set I was looking at the old label! Thus the "as" keyword in Proc SQL is behaving more like a rename than a computed new variable.
-Mary
|