I have a data file of survey responses where each record is a response to a single question by a single respondent. For each record, the respondent creates a pattern 1's and 0's that is stored in variables p1-p10.
I also have a string variable in the file called key that is the key to scoring the pattern of values in p1-p10 as either correct or incorrect.(e.g, string value in key might be "p7 and ( p3 or p8 )") .
So, now I want to score records in the file by creating a new variable called "iscorrect" that is value 1 if the logical expression in the key field resolves to true, value 0 otherwise.
Example: If the key field is "p7 and ( p3 or p8 )" and the value of variables p7 and p8 are 1, then iscorrect is 1.
I've been having difficulty using the macro facility to evaluate the string "key" variable as a logical expression. Any suggestions?