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 (February 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Feb 2000 15:42:54 GMT
Reply-To:     "John M. Wildenthal" <jmwildenthal@MY-DEJA.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "John M. Wildenthal" <jmwildenthal@MY-DEJA.COM>
Organization: Deja.com - Before you buy.
Subject:      Re: conditioned merging

In article <3.0.6.32.20000217224247.007f55f0@pinus.slu.se>, Torben Haslund <Torben.Haslund@VBIOL.SLU.SE> wrote: > Dear SAS-Lers, > > I want to merge: > data set A with B, if B but not C exists > data set A with C, if C but not B exists > data set A with B and C, if B and C exist. > > data a; > if b and not c exist merge a b; > if c and not b exist merge a c; > if b and c exist merge a b c; > > .... but how do I do that?

You didn't mention what if neither. I will assume you just reprocess a.

UNTESTED CODE...

%MACRO condmerg(a, b, c);

MERGE &a

%IF %SYSFUNC(EXIST(&b)) %THEN &b ; %IF %SYSFUNC(EXIST(&c)) %THEN &c ;

%STR(;) ;

%MEND;

DATA outlib.member; %condmerg(inlib.membera, inlib.memberb, inlib.memberc); RUN;

Sent via Deja.com http://www.deja.com/ Before you buy.


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