What you are attempting fails because when a step boundary such as a RUN, DATA or PROC statement is encountered that is considered the end of the code for a data step.
So you basically cannot embed Proc SQL code into a data step.
I think that you may be looking for something like (untested):
proc sql;
create table want as
select a.*
from in as a
right join
(select distinct col1 from t) as b
on a.col2=b.col1
;
quit;
One of the major strengths of SQL is to combine or select data based on values in two or more data sets. A key part is to identify what type of JOIN (there are several) and the conditions.
You may get better results by posting example start data and the desired result. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
BTW, while the syntax DATA in ; Set in; is legal it is a very poor general approach to coding as if you code had executed but done something undesired you have replaced the data set IN and would have to back to earlier steps to recreate the data.
Especially with very experimental code you are likely to damage the data.