DATA Step, Macro, Functions and more

Macro resolution and %IF-%Then %Else statements

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Macro resolution and %IF-%Then %Else statements

SYMBOLGEN:  Macro variable MBR_PED_IND resolves to N

MLOGIC(RUNNER):  %IF condition &mbr_ped_ind eq Y is FALSE

SYMBOLGEN:  Macro variable GDIST resolves to 319.6732

SYMBOLGEN:  Macro variable DIST_LIMIT1 resolves to 10

MLOGIC(RUNNER):  %IF condition &gdist le &dist_limit1 is FALSE

SYMBOLGEN:  Macro variable GDIST resolves to 319.6732

SYMBOLGEN:  Macro variable DIST_LIMIT2 resolves to 20

MLOGIC(RUNNER):  %IF condition &gdist le &dist_limit2 is FALSE

SYMBOLGEN:  Macro variable GDIST resolves to 319.6732

SYMBOLGEN:  Macro variable DIST_LIMIT3 resolves to 30

MLOGIC(RUNNER):  %IF condition &gdist le &dist_limit3 is FALSE

SYMBOLGEN:  Macro variable MBR_PED_IND resolves to Y

MLOGIC(RUNNER):  %IF condition &mbr_ped_ind eq Y is TRUE

SYMBOLGEN:  Macro variable GDIST resolves to  171.732

SYMBOLGEN:  Macro variable DIST_LIMIT1 resolves to 10

MLOGIC(RUNNER):  %IF condition &gdist le &dist_limit1 is FALSE

SYMBOLGEN:  Macro variable GDIST resolves to  171.732

SYMBOLGEN:  Macro variable DIST_LIMIT2 resolves to 20

MLOGIC(RUNNER):  %IF condition &gdist le &dist_limit2 is TRUE

The first block worked fined. However, in the second block especially in the colored portion, the condition evaluates to TRUE instead of FALSE. Clearly 171.20 is NOT less than 20. Can someone help with what's going on here? Thanks.


Accepted Solutions
Solution
‎08-13-2015 02:10 PM
Occasional Contributor
Posts: 7

Re: Macro resolution and %IF-%Then %Else statements

Posted in reply to Punxsutawney

I figured it out myself. I only needed to put the condition inside the function %sysevalf. Thanks.

View solution in original post


All Replies
Solution
‎08-13-2015 02:10 PM
Occasional Contributor
Posts: 7

Re: Macro resolution and %IF-%Then %Else statements

Posted in reply to Punxsutawney

I figured it out myself. I only needed to put the condition inside the function %sysevalf. Thanks.

Contributor
Posts: 39

Re: Macro resolution and %IF-%Then %Else statements

Posted in reply to Punxsutawney

Hey Punxsutawney,


I think you can still close your question as answered, so it doesn't draw attention for others that might want to try and answer the question.

Regards,

Vasilij

=======================================
For more information about {An}alytium, visit https://www.analytium.co.uk
Contributor
Posts: 69

Re: Macro resolution and %IF-%Then %Else statements

Posted in reply to Punxsutawney

Glad you figured out a solution.  It happened because macro variables are always character and '20' is greater than '171'.   %sysevalf (and %syseval) tells the macro processor to handle them as numeric values.


(Just thought this explanation might be useful to others.)


John

Occasional Contributor
Posts: 7

Re: Macro resolution and %IF-%Then %Else statements

Posted in reply to bentleyj1

Thanks.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 371 views
  • 0 likes
  • 3 in conversation