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 (October 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 2 Oct 2006 17:29:21 -0400
Reply-To:   Scott Czepiel <sczepiel@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Scott Czepiel <sczepiel@GMAIL.COM>
Subject:   Re: A question about %do %to statment in macro
In-Reply-To:   <BAY123-F1584E185BAF0F8C690EEC3DE1F0@phx.gbl>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

Alternatively, if you can find a way to do this outside of macro code, the iterative do statement in a data step DOES allow fractional increments:

On 10/2/06, toby dunn <tobydunn@hotmail.com> wrote: > > Minze , > > No you cant to fractional values in a %Do Loop, why, well because the %Do > Loop uses an implicit call to %Eval which only does integer values. > > Common way to over come this is: > > %Let Values = 0 0.5 1 ; > > %Do I = 1 To 3 ; > %Put %Scan( &Values , &I , %Str( ) ) ; > %End ; > > > > > Toby Dunn > > When everything is coming at you all at once, your in the wrong lane. > > A truly happy person is someone who can smile and enjoy the scenery on a > detour. > > > > > > From: Minze Su <slhappyls@GMAIL.COM> > Reply-To: Minze Su <slhappyls@GMAIL.COM> > To: SAS-L@LISTSERV.UGA.EDU > Subject: A question about %do %to statment in macro > Date: Mon, 2 Oct 2006 17:05:51 -0400 > > Dear all, > > I met the following problem: > > if I input this > > %macro outroc(dataset=ms.rocinput_mlr, stepsize=0.1, method='mlr'); > > > %do i=0 %to 1 %by 1; > %put &stepsize.; > %end; > > %mend outroc; > > It can give the right result. But if I change the step to 0.5. > > The log gives: > > > ERROR: A character operand was found in the %EVAL function or %IF > condition where a numeric > operand is required. The condition was: 0.5 > ERROR: The %BY value of the %DO I loop is invalid. > ERROR: The macro OUTROC will stop executing. > > Is it sas can not use a fractional value as step in do loop of Macro. Can > anyone help? > > Thank you in advance > > Best regards, > > Minze >


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