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 (March 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 16 Mar 2006 06:21:28 -0500
Reply-To:     Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Subject:      Re: conditional jobs


Below is a recursive macro approach. This is not very thoroughly tested, but generates correct answers for the provided example. I don't dare to guess what happens if a job has to wait on more than one other job.

I guess SAS/OR should have procs to do this kind of analyses.

Hth, Eric

data network; input node $ cond $ dur; cards; A . 3 B A 6 C B 3 D A 4 ; run;

proc sort data=network; by node; run;


data def (drop=cond) constr; set network; if cond = '' then output def; else output constr; run;

%global go_on;

%macro cp; proc sort data=def; by node; run;

proc sort data=constr; by cond; run;

%let go_on = 0;

data tmp (keep=node dur) constr; merge constr (in=constr) def (rename=(node=cond dur=durdef) in=def); by cond;

if constr and def then do; dur=dur+durdef; output tmp; end; else if constr then do; call symput("go_on", 1); output constr; end; run;

proc append base=def data=tmp; run;

proc sort data=def; by node; run;

%if (&go_on = 1) %then %cp;

%mend cp;


proc print data=def; run;

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