Date: Thu, 1 Sep 2005 21:10:47 -0700
Reply-To: shiling99@YAHOO.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: shiling99@YAHOO.COM
Organization: http://groups.google.com
Subject: Re: assigning many variable labels?
In-Reply-To: <1125598695.996985.100270@g47g2000cwa.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Actually you ask SAS to a label generate statement for u. That is sas
macro. As long as the request has logics that can be programminged, SAS
macro can be a big help.
Here is an example.
HTH
data t1;
retain a b c d e f;
run;
* recode a b c want recode as a_new b_new c_new;
%macro label(n=3, varlist=a b c);
%let new=;
%do i=1 %to &n;
%let new=&new %scan(&varlist,&i)_new="%scan(&varlist,&i) recode";
%end;
label &new
%mend;
data t2;
set t1;
a_new=a; d_new=d; e_new=e ; f_new=f;
%label(n=4, varlist=a d e f)
;
run;
proc contents; run;
|