|
Hi Stephen,
Just generate the label instructions of a proc datasets with some "call
execute" statements. Not too complicated.
Example **TESTED on MVS with SAS 8.00.00M0P11011999 *** follow:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* In the first dataset (it must have 50 obs) */
/* I assume variable "text" contains the label */
/* first obs = label of v1, and so on ... */
data _null_;
set first end=eof;
if _n_=1
then do;
call execute("proc datasets nolist;");
call execute("modify second;");
call execute("label ");
end;
call execute(" V"||put(_n_,2.-l)||'="'||trim(text)||'" ');
if eof then call execute(" ;quit;");
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanations:
The first block of call execute initialise the proc datasets
that will follow. It also issue the beginning of a LABEL statement. The
data step call generate the rest of the label instuction for each variable.
I'm assuming that you have one observation for each label.
It will run fast even for a big dataset since it doesn't read it
but just modify the labels.
Simple example of the power of the "call execute" !
Have fun with it,
\\\|///
\\ - - //
( @ @ )
+-----oOOo-(_)-oOOo--+-----------------------------------+
| Bernard Tremblay | |
| CSST | Tel: (418) 528-9313 |
| | Fax: (418) 528-1493 |
| | Int: Bernard.Tremblay@csst.qc.ca |
+----------------------------+---------------------------+
| Imaginasys enr | Res: (418) 658-1411 |
| | Int: bertrem@videotron.ca |
| | Hot: imaginasys@hotmail.com |
+--------------Oooo--+-----------------------------------+
oooO ( )
( ) ) /
\ ( (_/
\_)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>From: STEPHEN KURTZ <skurtz@CICINFO.COM>
>Reply-To: STEPHEN KURTZ <skurtz@CICINFO.COM>
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Assigning labels from a data set
>Date: Wed, 16 Aug 2000 09:56:14 -0400
>
>This should be an easy one:
>
>I have a data set with variables v1-v50 say. I also have a data set with
>corresponding labels for these variables. I want to be able to assign the
>labels to the variables without having to type in the actual labels in a
>label statement.
>
>Can anyone help me? Thanks in advance.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
|