<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use proc sql in SAS Data Studio Viya? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-proc-sql-in-SAS-Data-Studio-Viya/m-p/615216#M18719</link>
    <description>&lt;P&gt;Only FedSQL has been implemented in CAS. The FedSQL SQL implementation only supports non-correlated queries as documented &lt;A href="https://go.documentation.sas.com/?docsetId=casfedsql&amp;amp;docsetVersion=3.4&amp;amp;docsetTarget=p1ucns3lrhzhamn1k6fw6vhzhzam.htm&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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    
  ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 05 Jan 2020 21:49:35 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-01-05T21:49:35Z</dc:date>
    <item>
      <title>How to use proc sql in SAS Data Studio Viya?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-proc-sql-in-SAS-Data-Studio-Viya/m-p/615187#M18715</link>
      <description>&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my next job I have to work with SAS Visual Analytics because of this I have created a Trial Account on SAS Viya. At the SAS Data Studio in Transformation Code (CASL Editor), I have a problem with a subquery. I have created the following query in&amp;nbsp;FedSQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;loadActionSet 'fedsql';
queryCode = 'create table "'||_dp_outputCaslib||'"."'||_dp_outputTable||'" {options replace=true}
as select ID, Stadt, Stadt_upper, Einwohner, Bundesland, 
(Select sum(Einwohner) from "'||_dp_inputCaslib||'"."'||_dp_inputTable||'" as b where b.Bundesland = a.Bundesland) as Sum_Bundesland
from "'||_dp_inputCaslib||'"."'||_dp_inputTable||'" as a'; 
print queryCode;
ExecDirect / query=queryCode;&lt;/PRE&gt;&lt;P&gt;And i receive the following error message...&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The action was not successful&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ERROR: Unsupported operation in FedSQL query: Correlated subquery.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this message I change from FedSQL to PROC SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;loadActionSet 'proc sql';
queryCode = 'create table "'||_dp_outputCaslib||'"."'||_dp_outputTable||'" {options replace=true}
as select ID, Stadt, Stadt_upper, Einwohner, Bundesland, 
(Select sum(Einwohner) from "'||_dp_inputCaslib||'"."'||_dp_inputTable||'" as b where b.Bundesland = a.Bundesland) as Sum_Bundesland
from "'||_dp_inputCaslib||'"."'||_dp_inputTable||'" as a'; 
print queryCode;
ExecDirect / query=queryCode;&lt;/PRE&gt;&lt;P&gt;This is the next error message...&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The action was not successful&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ERROR: Load access denied for user xxx.xxx@xxx.de on action set _UNREGISTERED.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ERROR: Action set 'proc sql' was not loaded due to errors.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do I have to do, to use subquerys in the transformation code Step in SAS Data Studio?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards and thank you...&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jan 2020 13:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-proc-sql-in-SAS-Data-Studio-Viya/m-p/615187#M18715</guid>
      <dc:creator>Hansmuffs</dc:creator>
      <dc:date>2020-01-05T13:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc sql in SAS Data Studio Viya?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-proc-sql-in-SAS-Data-Studio-Viya/m-p/615216#M18719</link>
      <description>&lt;P&gt;Only FedSQL has been implemented in CAS. The FedSQL SQL implementation only supports non-correlated queries as documented &lt;A href="https://go.documentation.sas.com/?docsetId=casfedsql&amp;amp;docsetVersion=3.4&amp;amp;docsetTarget=p1ucns3lrhzhamn1k6fw6vhzhzam.htm&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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    
  ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Jan 2020 21:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-proc-sql-in-SAS-Data-Studio-Viya/m-p/615216#M18719</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-01-05T21:49:35Z</dc:date>
    </item>
  </channel>
</rss>

