Date: Wed, 28 Jul 2004 21:38:54 -0400
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject: Re: Copying label from one variable to another
Stanley Fogleman wrote:
> Is it possible to copy the label from var1 to var2 in the same data
> step? I can't seem to get past the syntax requirement that the label
> statement requires a string inside single or double quotes. Ordinarily
> I would assign a macro variable, but then you run into data step
> boundary issues.
> sample code:
> data temp;
> retain bogus_label '123456789012345678901234567890';
> set previous;
> bogus_label = vlabel(var1);
> label var2 = ???????
There is no function that will let you set the pdv label at runtime.
In general, the program statements of a data step that is running cannot
affect the header of the output tables being created by the DATA statement.
The header contains information about each variable; the name, type, length,
format, informat, label, constraints, etc...
You can store the label in a macro variable and use that in a Proc DATASETS
following the Data Step.
attrib bar length=$8 label='The label of "bar"';
xyz = 100;
if (_n_=1) then call symput ('barLabel', vlabel(bar));
proc datasets nolist lib=work;
Other techniques might use Proc CONTENTS or SQL DICTIONARY.COLUMNS
Richard A. DeVenezia