I am having an issue when using if-then-else in an array. This is the code I want to use, but when it runs it seems to ignore the original if statement as you can see in the image there are individuals who have "Achieved" selected and the AchievedGoal variable is listed as "No". data DSMESY2_test; set DSMESY2; array Ace ProblemSolving ReducingRisk BeingActive HealthyCoping HealthyEating Monitoring TakingMeds; do over Ace; if Ace = "Achieved" then AchievedGoal="Yes"; else AchievedGoal="No"; end; run; When I removed the "Else AchievedGoal="No"; statement, the array seems to work properly though. data DSMESY2_test; set DSMESY2; array Ace ProblemSolving ReducingRisk BeingActive HealthyCoping HealthyEating Monitoring TakingMeds; do over Ace; if Ace = "Achieved" then AchievedGoal="Yes"; end; run; I have tried to trouble shoot this so many times and I can't figure out what is going on. I can do a work around for my reporting by doing a proc freq/missing, for the second code, but it is driving me crazy not knowing why the top code isn't working especially because I know I have used it with other datasets with now issue.
... View more