I am new to SAS and am trying to make a new variable called LEVEL (1,2, or 3) using IF statements based on 3 other variables (x,y,z). Below is what I am doing, but the levels are incorrect. What am I doing wrong? Thank you for your help.
data a2; set a;
if category= "new" THEN DELETE;
if x = 1 AND y = 1 AND z = "HIGH" THEN LEVEL=1;
else if x = 1 AND y = 1 AND z = "MEDIUM" THEN LEVEL=1;
else if x = 0 AND y = 1 AND z = "HIGH" THEN LEVEL=1;
else if x = 0 AND y = 1 AND z = "HIGH" THEN LEVEL=2;
else TIER=3;
run;
Aucun commentaire:
Enregistrer un commentaire