LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Feb 2009 10:16:38 -0500
Reply-To:     Ian Whitlock <iw1sas@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <iw1sas@GMAIL.COM>
Subject:      Re: Conditional trigger
Comments: cc: "./ ADD NAME=Data _null_," <iebupdte@gmail.com>,
          Paul Lambson <paullambson@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Summary: Comment a %INC conditionally, or IFC. #iw-value=1

Data_null_;

We were thinking along the same lines but I would package it as

/* activate %inc every other Monday from 5jan2009 */ %let cntdays = %sysevalf(%sysfunc(today()) - "5jan2009"d) ; %let doinc = %substr(%str(* ) ,%eval((%sysfunc(mod(&cntdays,14)) =0)+1) ) ;

at the top of the program, and

&doinc%include 'W:\YIELDMGT\Ad Hoc\LDF_STS\LDF&STS-Y.sas';

wherever Paul had his include statement.

Or simplifying at the expense of complexity, replace the include statement with

/* do inc every other Monday from 5jan2009 */ %sysfunc(ifc(%sysfunc(mod(%sysfunc(today())-"5jan2009"d,14)) = 0 , %str(%inc ft15f001 / source2 ;) , %str() ))

Ian Whitlock ============== Date: Thu, 19 Feb 2009 06:18:23 -0600 From: "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM> Subject: Re: Conditional trigger Comments: To: Ian Whitlock <iw1sas@gmail.com> Comments: cc: Paul Lambson <paullambson@gmail.com> In-Reply-To: <30648bb30902181849g5a1f722y4c8f6f649bd298dd@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1

I did assume that the code to be included is complete step(s). I overlooked the problem with the Mondays, it seems that and interval multiplier and shift index will handle that nicely WEEK2.2.

filename ft15f001 temp; parmcards4; /* I am the file that represents Paul's file 'W:\YIELDMGT\Ad Hoc\LDF_STS\LDF&STS-Y.sas' to be run conditionally. */ proc contents data=sashelp.shoes varnum; run; ;;;; run;

data _null_; *today = today(); do today = '01jan2009'd to '01apr2009'd; biweek = intnx('week2.2',today,0); put 'NOTE: ' (_all_)(=); if today eq biweek then do; put 'NOTE: Today is the day for conditional %INC!! ' today= weekdate.; call execute('%inc ft15f001;'); end; end; format today biweek date9.; run;

On 2/18/09, Ian Whitlock <iw1sas@gmail.com> wrote: > Data_null_, > > I see two problems here. First - is the code to be part of the DATA > step? If yes, then > your code will not work since %INC is not a macro command. Second, > Paul asks for > every other Monday, but illustrates with first and third Mondays. > Some months can have 5 > Mondays. Is this important? > > Ian Whitlock > ========== > > Date: Wed, 18 Feb 2009 17:34:28 -0600 > From: "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM> > Subject: Re: Conditional trigger > Comments: To: Paul Lambson <paullambson@gmail.com> > In-Reply-To: <6b964db4-52e0-44ee-9e2f- b3cb77ced862@v39g2000yqm.googlegroups.com> > Content-Type: text/plain; charset=ISO-8859-1 > > use CALL EXECUTE to "execute" the %INC. > > > On 2/18/09, Paul Lambson <paullambson@gmail.com> wrote: > > I would like to run, within a sas code, a seperate sas code every > > other monday. Right now I have a code that can determine the first and > > third monday of a month but I am not able to include the code > > conditionally using %include. any pointers? is there another way to > > run code that is not a macro? > > > > data test; > > format month date9.; > > format firstmonday date9.; > > format thirdmonday date9.; > > month = intnx('month',today(),0); > > firstmonday = intnx('week',month,0)+1; > > thirdmonday= intnx('week',month,2)+1; > > if today() = firstmonday or today()=thirdmonday then %include 'W: > > \YIELDMGT\Ad Hoc\LDF_STS\LDF&STS-Y.sas'; > > run; > > > > > > thanks in advance, > > > > paul Lambson > > >


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