<?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 How do i use SQL data query in SAS Intelligent Decisioning to do lookup? (How to configure SAS MAS?) in Decisioning</title>
    <link>https://communities.sas.com/t5/Decisioning/How-do-i-use-SQL-data-query-in-SAS-Intelligent-Decisioning-to-do/m-p/645906#M5</link>
    <description>&lt;P&gt;I'm trying to build a Decision Flow in SAS Intelligent Decisioning on SAS Viya 3.5 but i stumble on a key feature that I can't get to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To simplify things lets take a basic example: Input to the decision flow is a customer ID, in the flow I need to look up customer information from a table in our internal database. Using that customer information I will do a bunch of cool stuff but first I need to solve how to do the look up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to some examples the Data Query (SQL Code) node is the tool to use for this and i've written this simple SQL lookup that should collect the customers status_code and age from the customerInformation table for the specific ID that is inputted to the node:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Select
Status_code as {:Status_code :string:10},
Age as {:Age:decimal},
ID as {:ID:decimal}

from casuser.CustomerInformation where ID = {?:ID:decimal}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I try to run the flow (or validate just the SQL code) I get the following error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Winter_0-1588863063199.png" style="width: 1090px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39169i3A6B3BFD16D6D8ED/image-dimensions/1090x30?v=v2" width="1090" height="30" role="button" title="Winter_0-1588863063199.png" alt="Winter_0-1588863063199.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Some information that i've found on the web suggest that some settings need to be configured for the SAS Micro Analytics Service in order to run a Decision Flow containing SQL code, see&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=edmag&amp;amp;docsetTarget=n1rj7lbqn5px2pn1q513o17dfkjs.htm&amp;amp;docsetVersion=5.3&amp;amp;locale=en" target="_self"&gt;Configuring Support for SQL Query Files&lt;/A&gt;&amp;nbsp;which in turn points me att DS2 configurations that hints at a connection string for FedSQL connections to different databases and now i'm totally lost&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt; All I want to do is to run a simple sql towards a SAS table in my viya database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The first question is, is the SQL code the correct approach to enrich the input data in a decision flow with information from a table in the database?&lt;/LI&gt;
&lt;LI&gt;If so, am I doing something wrong or do our environment need additional configuration? If so, what configurations are needed?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 May 2020 15:08:48 GMT</pubDate>
    <dc:creator>Winter</dc:creator>
    <dc:date>2020-05-07T15:08:48Z</dc:date>
    <item>
      <title>How do i use SQL data query in SAS Intelligent Decisioning to do lookup? (How to configure SAS MAS?)</title>
      <link>https://communities.sas.com/t5/Decisioning/How-do-i-use-SQL-data-query-in-SAS-Intelligent-Decisioning-to-do/m-p/645906#M5</link>
      <description>&lt;P&gt;I'm trying to build a Decision Flow in SAS Intelligent Decisioning on SAS Viya 3.5 but i stumble on a key feature that I can't get to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To simplify things lets take a basic example: Input to the decision flow is a customer ID, in the flow I need to look up customer information from a table in our internal database. Using that customer information I will do a bunch of cool stuff but first I need to solve how to do the look up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to some examples the Data Query (SQL Code) node is the tool to use for this and i've written this simple SQL lookup that should collect the customers status_code and age from the customerInformation table for the specific ID that is inputted to the node:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Select
Status_code as {:Status_code :string:10},
Age as {:Age:decimal},
ID as {:ID:decimal}

from casuser.CustomerInformation where ID = {?:ID:decimal}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I try to run the flow (or validate just the SQL code) I get the following error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Winter_0-1588863063199.png" style="width: 1090px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39169i3A6B3BFD16D6D8ED/image-dimensions/1090x30?v=v2" width="1090" height="30" role="button" title="Winter_0-1588863063199.png" alt="Winter_0-1588863063199.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Some information that i've found on the web suggest that some settings need to be configured for the SAS Micro Analytics Service in order to run a Decision Flow containing SQL code, see&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=edmag&amp;amp;docsetTarget=n1rj7lbqn5px2pn1q513o17dfkjs.htm&amp;amp;docsetVersion=5.3&amp;amp;locale=en" target="_self"&gt;Configuring Support for SQL Query Files&lt;/A&gt;&amp;nbsp;which in turn points me att DS2 configurations that hints at a connection string for FedSQL connections to different databases and now i'm totally lost&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt; All I want to do is to run a simple sql towards a SAS table in my viya database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The first question is, is the SQL code the correct approach to enrich the input data in a decision flow with information from a table in the database?&lt;/LI&gt;
&lt;LI&gt;If so, am I doing something wrong or do our environment need additional configuration? If so, what configurations are needed?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2020 15:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Decisioning/How-do-i-use-SQL-data-query-in-SAS-Intelligent-Decisioning-to-do/m-p/645906#M5</guid>
      <dc:creator>Winter</dc:creator>
      <dc:date>2020-05-07T15:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do i use SQL data query in SAS Intelligent Decisioning to do lookup? (How to configure SAS M</title>
      <link>https://communities.sas.com/t5/Decisioning/How-do-i-use-SQL-data-query-in-SAS-Intelligent-Decisioning-to-do/m-p/646574#M6</link>
      <description>&lt;P&gt;I can see two problems with your SQL query here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Attribute names and tables names should be in double-quotes&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;LI&gt;You cannot query CAS data directly via SQL data query node in SAS ID. Please configure your database connection in MAS configuration settings (&lt;A href="https://documentation.sas.com/?docsetId=masag&amp;amp;docsetTarget=n1c03kyv0j631yn1rdn2y4rl42yh.htm&amp;amp;docsetVersion=5.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;link&lt;/A&gt;) and then provide a catalog name in place of casuser&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;See sample SQL code which should work:&lt;/P&gt;&lt;PRE&gt;Select
"Status_code" as {:Status_code :string:10},
"Age" as {:Age:decimal},
"ID" as {:ID:decimal}
from "&amp;lt;&amp;lt;catalogName&amp;gt;&amp;gt;"."CustomerInformation" where "ID" = {?:ID:decimal}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 06:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Decisioning/How-do-i-use-SQL-data-query-in-SAS-Intelligent-Decisioning-to-do/m-p/646574#M6</guid>
      <dc:creator>amitc2605</dc:creator>
      <dc:date>2020-05-11T06:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do i use SQL data query in SAS Intelligent Decisioning to do lookup? (How to configure SAS M</title>
      <link>https://communities.sas.com/t5/Decisioning/How-do-i-use-SQL-data-query-in-SAS-Intelligent-Decisioning-to-do/m-p/650446#M7</link>
      <description>The biggest problem was the connection string and the not so obvious fact that you cant use "in memory" datasets.&lt;BR /&gt;&lt;BR /&gt;For others that might be locking for a solution:&lt;BR /&gt;I switched over to using the PUBLIC library for it to be a bit more universal for all users. In my case the physical location of public is /opt/sas/viya/config/data/cas/default/public/ (this can be found if you look at the library in the data manager)&lt;BR /&gt;And my connection string is:&lt;BR /&gt;&lt;BR /&gt;driver=SQL;conopts=(driver=base;catalog=public; schema=(name=public;primarypath=/opt/sas/viya/config/data/cas/default/public/))&lt;BR /&gt;&lt;BR /&gt;If you want to use other (PHYSICAL) libraries you can use the following code in SAS Studio to get the relevant connection strings in the log:&lt;BR /&gt;&lt;BR /&gt;option MSGLEVEL=i;&lt;BR /&gt;proc fedsql;&lt;BR /&gt;select sadasdasd from test.not_an_excisting_table /*this code generates error on purpose, we just want to see the log*/&lt;BR /&gt;;quit;&lt;BR /&gt;&lt;BR /&gt;One of the notes in the logg should contain the relevant connection string for all physical libraries that are assigned in SAS Studio. It should look something like this:&lt;BR /&gt;NOTE: driver=FEDSQL;conopts=((...</description>
      <pubDate>Mon, 25 May 2020 12:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Decisioning/How-do-i-use-SQL-data-query-in-SAS-Intelligent-Decisioning-to-do/m-p/650446#M7</guid>
      <dc:creator>Winter</dc:creator>
      <dc:date>2020-05-25T12:46:59Z</dc:date>
    </item>
  </channel>
</rss>

