I would try:
proc sql;
create table Stars_Compare as
(Select
A.ID,
<Other_Variables>,
case when first(Overall) in ("X", "Y") Then 'N/A'
else Overall end as star_2019
From work.Info A
Left join work.Stars B on
A.ID=B.ID)
where YYYY = '2019')
natural full join
(Select
A.ID,
<Other_Variables>,
case when first(Overall) in ("X", "Y") Then 'N/A'
else Overall end as star_2020
From work.Info A
Left join work.Stars B on
A.ID=B.ID)
where YYYY = '2020');
quit;
just make sure <Other_Variables> doesn't include YYYY.
... View more