```Date: Thu, 16 Mar 2006 08:56:44 -0500 Reply-To: "Howard Schreier " Sender: "SAS(r) Discussion" From: "Howard Schreier " Subject: Re: conditional jobs On Thu, 16 Mar 2006 06:21:28 -0500, Eric Hoogenboom wrote: >Dirk, > >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. Yes. PROC CPM. > >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; > >/* SPLIT NETWORK IN DEFINITIVE DURATION AND UNDER CONSTRUCTION */ > >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; > >%cp > >proc print data=def; >run; ```

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