lundi 24 août 2015

In SAS, how to execute a variable string as an if-statement (var = "if x = y")?

I have a data set with a variable named "Condition" that I want to use in the code. I'm guessing I need to do it in a macro but I'm still learning how to write macros in SAS.

So if my data set is this:

Question,Answer,Condition,Result
Q1,1,Answer=1," "
Q2,2,Answer=1," "
Q3,3,Answer=4," "

Then I want the program to take the Condition variable as a string and then use it as an if statement:

if Condition then Result = "Correct";

Is this possible?

Aucun commentaire:

Enregistrer un commentaire