Date: Wed, 22 Dec 2004 14:27:00 -0500
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Change the label on fly, any better way?
Hi There,
The follwing code change the variable a's label based on its value.
I wonder if there is a better way to do it. I've got a feeling,
the two data step in the macro can be combined. I tried to use
%sysfunc and symget, but failed.
Thanks
Ya
--------------
data xx;
a='breakfast'; delta=23; output;
a='lunch'; delta=56; output;
run;
%macro doit(a=);
data _null_;
set xx;
if a="&a";
call symput('alb',a);
run;
data yy;
set xx;
if a="&a";
label a="&alb";
run;
proc print label;
run;
%mend;
%doit(a=breakfast);
%doit(a=lunch);
|