Date: Wed, 9 Dec 2009 13:50:40 -0800
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: Putting the value of a %do loop every thousandth time?
In-Reply-To: <20091209134059.47DF5640@resin17.mta.everyone.net>
Content-Type: text/plain; charset=utf-8
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Mary
> Sent: Wednesday, December 09, 2009 1:41 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Putting the value of a %do loop every thousandth time?
>
> Hi,
>
> I currently have a loop in a macro:
>
> %do i=1 %to &max;
>
> %end;
>
> Currently I get out this message:
>
> MLOGIC(GET_RESULTS): %DO loop index variable I is now 24563; loop will
> iterate again.
>
> But now I want to try to run it on about 700,000 loops; is there a way I can do
> something
> like
> %put i=&i;
>
> But only once every thousandth time or so so my log won't be huge but I can still
> check where it is at? i.e. I'd like to say
> if mod(i, 1000)=0 then %put i=&i;
>
> But I'm not sure how to do the code with a macro variable.
>
> Also, if I get this working, how do I turn off the message from mlogic?
>
> -Mary
Mary,
You can use %sysfunc() like this:
%if %sysfunc(mod(&i,1000)) EQ 0 %then %put i=&i;
I don't know the answer to your mlogic question.
Hope this is helpful,
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|