Date: Mon, 2 Aug 1999 08:36:06 +0100
Reply-To: tra <tra@PROTEUS.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: tra <tra@PROTEUS.CO.UK>
Organization: Proteus Molecular Design Ltd
Subject: Re: Making label follow value (in merge)
Content-Type: text/plain; charset=us-ascii
Here is a trick I have used in similar circumstances:
data merged ;
merge b(obs=0) a b ;
by byvar ;
run ;
Tim
Tom Frenkel wrote:
> To SAS-L:
>
> It seems that, when you merge 2 datasets that have a common variable, SAS
> uses the label assigned to the *first* instance of the variable it sees,
> while of course using the value of the *last* instance. Thus if we have:
>
> data a ;
> byvar=1 ;
> x=10 ;
> label x = 'from a' ;
> run ;
>
> data b ;
> byvar=1 ;
> x=20 ;
> label x = 'from b' ;
> run ;
>
> data merged ;
> merge a b ;
> by byvar ;
> run ;
>
> the value of x in "merged" will of course be 20. But its label will be
> 'from a'. Is there any way to change the label to 'from b', thus making
> the label of the variable consistent with its value? Thanks!
>
> --Tom
>
> Tom Frenkel
> Assoc. Research Scientist
> Center for Health & Public Service Research
> New York University
> taf2@is8.nyu.edu
--
T R Auton PhD MSc C.Math
Head of Biomedical Statistics
Proteus Molecular Design Ltd
Beechfield House
Lyme Green Business Park
Macclesfield
Cheshire SK11 0JL
UK
email: tra@proteus.co.uk
|