From: Patrick on
I can't find this PROC SQL in the code you've posted.

There second PROC SURVEYSELECT is not finished. Where is the run/quit?
From: Patrick on
Also: In the first where statement (where val = 10 and val 2 =2;)
is a blank between "VAL" and "2". This might be the reason for the
error you get.
From: Tom Abernathy on
Also you have an extra semi-colon after you last %ELSE
I assume that you wanted

%ELSE %DO;
proc surveyselect ....

%END;