LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 16 Aug 2000 11:56:56 EDT
Reply-To:   Bernard Tremblay <imaginasys@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Bernard Tremblay <imaginasys@HOTMAIL.COM>
Subject:   Re: Assigning labels from a data set
Comments:   To: skurtz@CICINFO.COM
Content-Type:   text/plain; charset=iso-8859-1; format=flowed

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


Back to: Top of message | Previous page | Main SAS-L page