## %Sysevalf

Solved
Super Contributor
Posts: 1,041

# %Sysevalf

Hi Team,

I was reading a paper on Do loops and Do loops  in Macros

http://analytics.ncsu.edu/sesug/2010/FF01.Woodruff.pdf

On page 18 it says you  can use this method

only when you intervals to be calculated that are a factor of 10;

for .1 divide by 10,

for .2 divide by 5 and

for .5 divide by 2.  (if we do this we get the values from 5.0,5.5 6.0 so on) We actually wanted 10.0 10.5 11.0 11.5 etc????????

%Macro Test ;

%Do I = %SysEvalF( 1 * 10 ) %To %SysEvalF( 2 * 10 ) ;

%Put I = %sysEvalF( &I / 10 ) ;

%End ;

%Mend ;

%Test

I = 1

I = 1.1

I = 1.2

I = 1.3

I = 1.4

I = 1.5

I = 1.6

I = 1.7

I = 1.8

I = 1.9

I = 2

In the above code we have used the %SysEvalF for the Start, Stop and in the %PUT to increment the values from 1

to 2 by 0.1. This works solely because the math in the Start and Stop values will create the needed number of

iterations and the %SysEvalF in the %PUT will manipulate the values to create the desired output.

Accepted Solutions
Solution
‎10-08-2012 06:44 PM
PROC Star
Posts: 7,645

## Re: %Sysevalf

Karun: Not sure what your question is.  You could get the values you want with (although the %SysEvalF is only really needed for the 2nd of the two %put statements):

%Macro Test ;

%Do I = %SysEvalF( 1 * 10 ) %To %SysEvalF( 2 * 10 ) ;

%Put I = %sysEvalF( &I  ) ;

%Put I = %sysEvalF( &I + .5 ) ;

%End ;

%Mend ;

%Test

All Replies
Solution
‎10-08-2012 06:44 PM
PROC Star
Posts: 7,645

## Re: %Sysevalf

Karun: Not sure what your question is.  You could get the values you want with (although the %SysEvalF is only really needed for the 2nd of the two %put statements):

%Macro Test ;

%Do I = %SysEvalF( 1 * 10 ) %To %SysEvalF( 2 * 10 ) ;

%Put I = %sysEvalF( &I  ) ;

%Put I = %sysEvalF( &I + .5 ) ;

%End ;

%Mend ;

%Test

🔒 This topic is solved and locked.