Hi Statalist members,
I am comparing data on responses to thirty test questions ("variable") to the correct answers to those questions ("a_variable"). I want to generate a new variable that tells me whether the response is correct, incorrect, or missing ("r_variable").
In other words, I want to run this code for thirty variables (one varlist) against thirty response variables (another varlist):
I searched previous posts but couldn't figure out how to apply responses to my data and variables.
I am using Stata 11.2.
Thank you very much!
Best,
Corinna
I am comparing data on responses to thirty test questions ("variable") to the correct answers to those questions ("a_variable"). I want to generate a new variable that tells me whether the response is correct, incorrect, or missing ("r_variable").
In other words, I want to run this code for thirty variables (one varlist) against thirty response variables (another varlist):
gen r_variable=1 if variable==a_variable(My codes for "missing" or "incomplete" are values 99 and higher, so I have no missing values in my original variables.)
replace r_variable=0 if variable!=a_variable
replace r_variable=. if variable>;=99
I searched previous posts but couldn't figure out how to apply responses to my data and variables.
I am using Stata 11.2.
Thank you very much!
Best,
Corinna
Comment