02-22-2018 02:33 PM - edited 02-22-2018 03:00 PM
I have a macro program that I've written that uses multiple parameters.
One of these parameters is the clients' name. The macro looks something like this:
The commands that are called using the macro are pages and pages long but there is a certain place where I want to create a set of conditional statements for calculations based on the value of &ClientCode.
Basically something like this
if &ClientCode = "Client1" then Calculation = VAR1 +VAR2+VAR3;
else if &ClientCode= "Client2" then Calculation = VAR1 + VAR3 + VAR4;
else if &ClientCode = "Client3" then Calculation = Var2 + VAR4 + VAR6;
But that is not working correctly.
I feel like this is a relatively simple command I am trying to execute. Can someone show me the correct synthax?
02-22-2018 02:48 PM
How do these calculations depend on the value of &Response ?
The correct syntax depends on what is contained in the macro variables. In particular, what is the value for &ClientCode ?
02-22-2018 02:59 PM
The Value would be a string of 4 characters that are a code for the client.
Some clients calculate their total budget based on different combinations of Variables
02-22-2018 04:53 PM
Not sure what RESPONSE has to do with your question as the code you posted is referencing the parameter CLIENTCODE instead.
So code like this:
data work.want; set work.have; if &ClientCode = "Client1" then Calculation = VAR1 +VAR2+VAR3; else if &ClientCode= "Client2" then Calculation = VAR1 + VAR3 + VAR4; else if &ClientCode = "Client3" then Calculation = Var2 + VAR4 + VAR6;
Will work you you set CLIENTCODE equal to something that evaluates to a character string. So you could call it with a string literal.
Or you could call it with the name of a character variable that is in the HAVE dataset.
Or even a function call that can run in the generated IF statement as long it the result is a character string that the IF statement can compare to the literal character values.
Need further help from the community? Please ask a new question.