Only FedSQL has been implemented in CAS. The FedSQL SQL implementation only supports non-correlated queries as documented here.
From a coding perspective: Depending on the Viya version there are many things for which you don't need action sets but can use more "traditional" SAS syntax. For what you're doing the following two coding approaches should work (not tested).
proc fedsql sessref=mysess;
create table _dp_outputCaslib._dp_outputTable {options replace=true} as
select
id,
stadt,
stadt_upper,
einwohner,
bundesland,
sum(Einwohner) as Sum_Bundesland
from _dp_inputCaslib._dp_inputTable
group by
id,
stadt,
stadt_upper,
einwohner,
bundesland
;
data _dp_outputCaslib._dp_outputTable;
set _dp_inputCaslib._dp_inputTable;
by Bundesland;
keep id stadt stadt_upper einwohner bundesland sum_bundesland;
retain sum_bundesland;
if first.bundesland then sum_bumdesland=0;
sum_bumdesland=sum(sum_bumdesland,Einwohner);
run;
... View more