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 (June 1998, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 18 Jun 1998 17:29:49 GMT
Reply-To:   DNordlund <dnordlund@AOL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   DNordlund <dnordlund@AOL.COM>
Organization:   AOL http://www.aol.com
Subject:   Re: Yet Another Simple Macro Problem

Myra.Oltsik@responseinsurance.com wrote:

>I've written several simple macros like this one without a problem. Can >someone please tell me what I'm not seeing that's wrong? I submit the macro >but nothing runs, as if I haven't started it at all. I've tried making >several, small changes, with no results. I've tried putting the ; after the >macro name at the bottom and tried it without the ;. I know I'm missing >something, but I can't figure out what. > >%let tdate = %sysfunc(today()); > >%macro mpif; > > %do n = -1 %to -6;

##### %DO n = -1 %TO -6 %BY 1;

> > %let x = %eval(&n); > > data _null_; > m = &x + 1; > call symput ('mtdate',intnx('month',&tdate,m)); > call symput ('etdate',intnx('month',&tdate,x)); ##### I believe you need to use &x in the above statement; > run; > > data _null_; > call symput ('yr',put(year(&etdate),4.)); > call symput ('mon',put(month(&etdate),z2.)); > run; > > data &yr&mon (drop=vehprem1-vehprem6); > set noas.policies (keep= > policyno > company > effdate > expdate > transtyp > cncldate > vehprem1-vehprem6 > totprem > ) > noas.pols_old (keep= > policyno > company > effdate > expdate > transtyp > cncldate > vehprem1-vehprem6 > totprem > ); > IF TRANSTYP NE '23' THEN CNCLDATE = .; > IF CNCLDATE NE . THEN LASTDAY = CNCLDATE; > ELSE LASTDAY = EXPDATE; > vehs = 0; > array cars{6} vehprem1-vehprem6; > do i = 1 to 6; > if cars{i} > 0 then vehs = vehs + 1; > end; > drop i; > IF EFFDATE LT &etdate AND LASTDAY GE &mtdate THEN output; > run; > > %end; > >%mend mpif; > >%mpif >

I didn't go through the macro in detail, but I believe the macro does nothing because the macro DO LOOP at the beginning needs to count down from -1 to -6; add a %BY -1 to the statement like:

%do n = -1 %to -6 %BY -1;

Also, in the first datastep, the definition of etdate needs to use &X i believe. This should get you something that you can then further debug.

Hope this helps,

Dan Nordlund


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