<?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: Save scoring input data from MAS REST API call in SAS Viya</title>
    <link>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899348#M2060</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/350173"&gt;@TimStettner&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My answer will focus on two main ways of doing this and I will also augment the answers to include the SAS Container Runtime (SCR) as one possibility that is available in addition to MAS in SAS Viya 4:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Making use of the Logging, this builds on top of what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260759"&gt;@SophiaRowland&lt;/a&gt;&amp;nbsp;as already mentioned&lt;/P&gt;
&lt;P&gt;2. Writing to a database&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Logging&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The logging of both MAS and SCR are a great way of enabling your use case because they require only a one time setup by the admin. Also logging is extremely fast and thus as a minimal performance impact for the scoring. Making use of the archival function for MAS mentioned by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260759"&gt;@SophiaRowland&lt;/a&gt;&amp;nbsp; is a great way of doing it (&lt;A href="https://go.documentation.sas.com/doc/en/mascdc/default/masag/n0yfb6f53gngamn1tn7k0a5c60i6.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascdc/default/masag/n0yfb6f53gngamn1tn7k0a5c60i6.htm&lt;/A&gt;), or of course you can make use of the base MAS logs, but it would require capturing them and parsing them (&lt;A href="https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1bpmaoscsf0rnn0z1dz3i6n0k4a.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1bpmaoscsf0rnn0z1dz3i6n0k4a.htm&lt;/A&gt;). In SCR it can be set via the option&amp;nbsp;&lt;SPAN&gt;SAS_SCR_LOG_LEVEL_SCR_IO&lt;/SPAN&gt; (&lt;A href="https://go.documentation.sas.com/doc/en/mascrtcdc/v_018/mascrtag/p1syrp759enejnn1s6jvuw1ia9c5.htm?fromDefault=#p19wd6anldyq55n1vvezs8j2uhlx" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascrtcdc/default/mascrtag/p1syrp759enejnn1s6jvuw1ia9c5.htm?fromDefault=#p19wd6anldyq55n1vvezs8j2uhlx&lt;/A&gt;) for the logs and then parsing needs to be applied.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Database&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Capturing the In/Outputs and writing them to a database is a bit more tricky. First this introduces a bigger performance penalty then logging, even with concepts like connection pooling etc., you might it time outs, have to do retries, etc.. Also note that MAS currently only supports a subset of the SAS Viya supported databases (&lt;A href="https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1f863xqncrgajn15lz2xl7ffk1h.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1f863xqncrgajn15lz2xl7ffk1h.htm&lt;/A&gt;), same applies for SCR (&lt;A href="https://go.documentation.sas.com/doc/en/mascrtcdc/default/mascrtag/n15q5afwsfkjl5n1cfvcn7xz4x22.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascrtcdc/default/mascrtag/n15q5afwsfkjl5n1cfvcn7xz4x22.htm&lt;/A&gt;). The next thing is of course what you already touched on namely that if we are talking just a model it would require changing the Score Code of your model to include the database connect and write, which would be a manual step and similar to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260759"&gt;@SophiaRowland&lt;/a&gt;&amp;nbsp;I would also advise against going that route. As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt;&amp;nbsp;mentions if using SAS Intelligent Decisioning is an option, this would open two additional ways of doing it by adding a node after the model in the decision - either making use of a Custom DS2 code or making use of the Record Contacts node (&lt;A href="https://go.documentation.sas.com/doc/en/edmcdc/default/edmug/n10hwvizrf0fbgn1mdhwahnwfavz.htm?requestorId=14c88244-2c18-480f-9d40-9ad87ba329d6" target="_blank"&gt;https://go.documentation.sas.com/doc/en/edmcdc/default/edmug/n10hwvizrf0fbgn1mdhwahnwfavz.htm?requestorId=14c88244-2c18-480f-9d40-9ad87ba329d6&lt;/A&gt;).&lt;BR /&gt;In any way the Database approach would also require to be reimplemented for each new model/decision.&lt;BR /&gt;&lt;BR /&gt;So with all of that out of the way, I want to quickly mention that of course the calling application could also save the In/Outputs but that would be a decentralized effort and require contact with different users.&lt;BR /&gt;&lt;BR /&gt;The logging based approach to me as the most upside, while requiring little configuration and on going effort and also opening the avenue to potentially use other logging modules to track module performance, etc..&lt;BR /&gt;&lt;BR /&gt;Best, David&lt;/P&gt;</description>
    <pubDate>Fri, 20 Oct 2023 10:01:34 GMT</pubDate>
    <dc:creator>DavidHD</dc:creator>
    <dc:date>2023-10-20T10:01:34Z</dc:date>
    <item>
      <title>Save scoring input data from MAS REST API call</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899217#M2052</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;in a "real-time"-scoring scenario for a predictive model we want to use MAS as publishing destination for this model.&lt;/P&gt;&lt;P&gt;The scoring should then be called via the microanalyticScore&amp;nbsp; API, and here the generated endpoint/step "score".&lt;/P&gt;&lt;P&gt;So far, so good.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm now struggeling a bit with an additional requirement:&lt;/P&gt;&lt;P&gt;We also want to collect the input/output data from this scoring "somewhere" in SAS (as file, table, in CAS, or however).&lt;/P&gt;&lt;P&gt;Is there any option to add this as a step in the MAS module? Or could we add this in the DS2 score code within Model Manager?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope there is any idea how we could solve that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!!&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 10:54:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899217#M2052</guid>
      <dc:creator>TimStettner</dc:creator>
      <dc:date>2023-10-19T10:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Save scoring input data from MAS REST API call</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899295#M2056</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you using SAS Intelligent Decisioning (ID) or not?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you read this SAS Communities Library Article?&lt;/P&gt;
&lt;P&gt;Home &amp;gt; SAS Communities Library &amp;gt; &lt;BR /&gt;Scoring using Models Deployed into MAS over REST API: A Step-by-Step Guide&lt;BR /&gt;Started ‎06-05-2023 | Modified ‎06-05-2023&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Scoring-using-Models-Deployed-into-MAS-over-REST-API-A-Step-by/ta-p/876429" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Scoring-using-Models-Deployed-into-MAS-over-REST-API-A-Step-by/ta-p/876429&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260759"&gt;@SophiaRowland&lt;/a&gt;&amp;nbsp;or &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120448"&gt;@Roel&lt;/a&gt;&amp;nbsp;can help you out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR,&lt;BR /&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 16:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899295#M2056</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-10-19T16:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Save scoring input data from MAS REST API call</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899313#M2059</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/350173"&gt;@TimStettner&lt;/a&gt;!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend against adding a step within the model code to write out the results as this could increase the time it takes for the model to execute. Instead, there is an archive feature in MAS to record the inputs and outputs of REST API calls.&amp;nbsp;To use the archive feature, SAS Micro Analytic Service must be configured with a persistent volume to use as a location in which to store the log files. This link to the documentation explains more:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/mascdc/v_027/masag/n0yfb6f53gngamn1tn7k0a5c60i6.htm" target="_blank" rel="noopener"&gt;https://go.documentation.sas.com/doc/en/mascdc/v_027/masag/n0yfb6f53gngamn1tn7k0a5c60i6.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 19:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899313#M2059</guid>
      <dc:creator>SophiaRowland</dc:creator>
      <dc:date>2023-10-19T19:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Save scoring input data from MAS REST API call</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899348#M2060</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/350173"&gt;@TimStettner&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My answer will focus on two main ways of doing this and I will also augment the answers to include the SAS Container Runtime (SCR) as one possibility that is available in addition to MAS in SAS Viya 4:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Making use of the Logging, this builds on top of what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260759"&gt;@SophiaRowland&lt;/a&gt;&amp;nbsp;as already mentioned&lt;/P&gt;
&lt;P&gt;2. Writing to a database&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Logging&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The logging of both MAS and SCR are a great way of enabling your use case because they require only a one time setup by the admin. Also logging is extremely fast and thus as a minimal performance impact for the scoring. Making use of the archival function for MAS mentioned by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260759"&gt;@SophiaRowland&lt;/a&gt;&amp;nbsp; is a great way of doing it (&lt;A href="https://go.documentation.sas.com/doc/en/mascdc/default/masag/n0yfb6f53gngamn1tn7k0a5c60i6.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascdc/default/masag/n0yfb6f53gngamn1tn7k0a5c60i6.htm&lt;/A&gt;), or of course you can make use of the base MAS logs, but it would require capturing them and parsing them (&lt;A href="https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1bpmaoscsf0rnn0z1dz3i6n0k4a.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1bpmaoscsf0rnn0z1dz3i6n0k4a.htm&lt;/A&gt;). In SCR it can be set via the option&amp;nbsp;&lt;SPAN&gt;SAS_SCR_LOG_LEVEL_SCR_IO&lt;/SPAN&gt; (&lt;A href="https://go.documentation.sas.com/doc/en/mascrtcdc/v_018/mascrtag/p1syrp759enejnn1s6jvuw1ia9c5.htm?fromDefault=#p19wd6anldyq55n1vvezs8j2uhlx" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascrtcdc/default/mascrtag/p1syrp759enejnn1s6jvuw1ia9c5.htm?fromDefault=#p19wd6anldyq55n1vvezs8j2uhlx&lt;/A&gt;) for the logs and then parsing needs to be applied.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Database&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Capturing the In/Outputs and writing them to a database is a bit more tricky. First this introduces a bigger performance penalty then logging, even with concepts like connection pooling etc., you might it time outs, have to do retries, etc.. Also note that MAS currently only supports a subset of the SAS Viya supported databases (&lt;A href="https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1f863xqncrgajn15lz2xl7ffk1h.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascdc/default/masag/n1f863xqncrgajn15lz2xl7ffk1h.htm&lt;/A&gt;), same applies for SCR (&lt;A href="https://go.documentation.sas.com/doc/en/mascrtcdc/default/mascrtag/n15q5afwsfkjl5n1cfvcn7xz4x22.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/mascrtcdc/default/mascrtag/n15q5afwsfkjl5n1cfvcn7xz4x22.htm&lt;/A&gt;). The next thing is of course what you already touched on namely that if we are talking just a model it would require changing the Score Code of your model to include the database connect and write, which would be a manual step and similar to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260759"&gt;@SophiaRowland&lt;/a&gt;&amp;nbsp;I would also advise against going that route. As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt;&amp;nbsp;mentions if using SAS Intelligent Decisioning is an option, this would open two additional ways of doing it by adding a node after the model in the decision - either making use of a Custom DS2 code or making use of the Record Contacts node (&lt;A href="https://go.documentation.sas.com/doc/en/edmcdc/default/edmug/n10hwvizrf0fbgn1mdhwahnwfavz.htm?requestorId=14c88244-2c18-480f-9d40-9ad87ba329d6" target="_blank"&gt;https://go.documentation.sas.com/doc/en/edmcdc/default/edmug/n10hwvizrf0fbgn1mdhwahnwfavz.htm?requestorId=14c88244-2c18-480f-9d40-9ad87ba329d6&lt;/A&gt;).&lt;BR /&gt;In any way the Database approach would also require to be reimplemented for each new model/decision.&lt;BR /&gt;&lt;BR /&gt;So with all of that out of the way, I want to quickly mention that of course the calling application could also save the In/Outputs but that would be a decentralized effort and require contact with different users.&lt;BR /&gt;&lt;BR /&gt;The logging based approach to me as the most upside, while requiring little configuration and on going effort and also opening the avenue to potentially use other logging modules to track module performance, etc..&lt;BR /&gt;&lt;BR /&gt;Best, David&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 10:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Save-scoring-input-data-from-MAS-REST-API-call/m-p/899348#M2060</guid>
      <dc:creator>DavidHD</dc:creator>
      <dc:date>2023-10-20T10:01:34Z</dc:date>
    </item>
  </channel>
</rss>

