<?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: VDMML SAS code node, score a model within a data step in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987475#M11124</link>
    <description>&lt;P&gt;&lt;SPAN&gt;A logistic regression in Model Studio creates&amp;nbsp;DATA step score code indeed (and not an Analytic store).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;See here for a table Node Name +&amp;nbsp;Type of Score Code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://go.documentation.sas.com/doc/en/vdmmlcdc/v_031/vdmmladvug/p0avxptqga2me0n0z81v01ky6t9o.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/vdmmlcdc/v_031/vdmmladvug/p0avxptqga2me0n0z81v01ky6t9o.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But the data step score code from a preceding logistic regression will not be the content of the&amp;nbsp;&amp;amp;dm_file_scorecode macro variable in a&amp;nbsp;subsequent code node.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Model Studio will use &amp;amp;dm_file_scorecode to get the score code for your code node.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This happens if you dynamically (and data-driven) create score code with the SAS code node in Model Studio. You should use&amp;nbsp;&amp;amp;dm_file_scorecode as your destination file in that case. If you hard-code score code in the score code pane, it will also be put in that file (without you explicitly referencing it).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The score code can be anything like a data mining preprocessing step on your data (it does not have to be a model).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Data flowing through the code node will be scored.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tip: How to include the SAS Code node in SAS® Visual Data Mining and Machine Learning's Model Studio&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Tip-How-to-include-the-SAS-Code-node-in-SAS-Visual-Data-Mining/ta-p/506012" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Tip-How-to-include-the-SAS-Code-node-in-SAS-Visual-Data-Mining/ta-p/506012&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Koen&lt;/P&gt;</description>
    <pubDate>Thu, 07 May 2026 13:43:16 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2026-05-07T13:43:16Z</dc:date>
    <item>
      <title>VDMML SAS code node, score a model within a data step</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987389#M11123</link>
      <description>&lt;P&gt;Right after supervised learning nodes in Model Studio VDMML on SAS Viya 4, I place a sas code node to score a table with the learned scoring code. Meanwhile I can use the macro variable for referencing the astore after SVM and Gradient Boosting for example, I cannot figure out how to so for models that do not produce astore like logistic regression.&lt;/P&gt;
&lt;P&gt;I can only achieve the scoring operation if I hard-cop the scoring code from the prior node and paste it into the data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of my many attempts is this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data grid_scored;
    set grid;
    %include "&amp;amp;dm_file_scorecode.";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic6.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114782i53672A812A0B4976/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic6.png" alt="pic6.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic5.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114780i7F33E2D177733A79/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic5.png" alt="pic5.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic4.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114781iAB81FEBCE52592EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic4.png" alt="pic4.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic3.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114779i779870B3A4A0B75F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic3.png" alt="pic3.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic2.png" style="width: 940px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114783i5250606F1139BE64/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic2.png" alt="pic2.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114784iBE620F0529BC242F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic1.png" alt="pic1.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2026 07:13:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987389#M11123</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2026-05-06T07:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: VDMML SAS code node, score a model within a data step</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987475#M11124</link>
      <description>&lt;P&gt;&lt;SPAN&gt;A logistic regression in Model Studio creates&amp;nbsp;DATA step score code indeed (and not an Analytic store).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;See here for a table Node Name +&amp;nbsp;Type of Score Code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://go.documentation.sas.com/doc/en/vdmmlcdc/v_031/vdmmladvug/p0avxptqga2me0n0z81v01ky6t9o.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/vdmmlcdc/v_031/vdmmladvug/p0avxptqga2me0n0z81v01ky6t9o.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But the data step score code from a preceding logistic regression will not be the content of the&amp;nbsp;&amp;amp;dm_file_scorecode macro variable in a&amp;nbsp;subsequent code node.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Model Studio will use &amp;amp;dm_file_scorecode to get the score code for your code node.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This happens if you dynamically (and data-driven) create score code with the SAS code node in Model Studio. You should use&amp;nbsp;&amp;amp;dm_file_scorecode as your destination file in that case. If you hard-code score code in the score code pane, it will also be put in that file (without you explicitly referencing it).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The score code can be anything like a data mining preprocessing step on your data (it does not have to be a model).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Data flowing through the code node will be scored.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tip: How to include the SAS Code node in SAS® Visual Data Mining and Machine Learning's Model Studio&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Tip-How-to-include-the-SAS-Code-node-in-SAS-Visual-Data-Mining/ta-p/506012" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Tip-How-to-include-the-SAS-Code-node-in-SAS-Visual-Data-Mining/ta-p/506012&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Koen&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2026 13:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987475#M11124</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-05-07T13:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: VDMML SAS code node, score a model within a data step</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987478#M11125</link>
      <description>&lt;P&gt;Why don't you use&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Add child node -&amp;gt; Miscellaneous -&amp;gt; "Score Data" - node&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;??&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This will allow you to score a table of your choice with the model that was built in the preceding supervised modeling node !&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR, Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2026 13:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987478#M11125</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-05-07T13:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: VDMML SAS code node, score a model within a data step</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987480#M11126</link>
      <description>&lt;P&gt;Because I want to score a grid of points and visualize it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the working example for a sas code node whose parent is a Gradient Boosting node.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My challenge is to "macrotize" the scoring code that is generated from logistic regression for example.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* SAS code */

%put &amp;amp;_astore;

/* 1. Create grid in the project caslib */
data casuser.grid;
  do x = 0 to 200 by 1;
    do y = 0 to 200 by 1;
            group = rand("integer", 3); 
      output;
    end;
  end;
run;


proc astore;
   score data=casuser.grid
            rstore=&amp;amp;dm_output_lib..&amp;amp;_astore
         copyvars=(x y)
         out=casuser.grid_scored;
run;

ods graphics on;
proc sgplot data=casuser.grid_scored aspect=1;
  title "Decision Surface (Heatmap)";
  heatmap x=x y=y / colorresponse=&amp;amp;DM_PREDICTED_VVNVAR colorstat=mean;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 May 2026 14:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987480#M11126</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2026-05-07T14:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: VDMML SAS code node, score a model within a data step</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987542#M11127</link>
      <description>&lt;P&gt;I think you have to select "&lt;EM&gt;Download score code&lt;/EM&gt;" and then copy / paste.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand that's not very dynamic though. When the model changes, you have to copy/paste again ... not very practical ...not very handy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option is you use PROC LOGSELECT with the CODE statement. The CODE statement writes the body of the score-code data step to an external file. And you can %INCLUDE that external *.sas file in a subsequent step to score new data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the PROC LOGSELECT you can avoid hard-coding table names and variable names. All you need is in automatic macro variables!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also:&lt;/P&gt;
&lt;P&gt;Using SAS Viya Data Step Score Code in SAS 9.4&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Using-SAS-Viya-Data-Step-Score-Code-in-SAS-9-4/ta-p/677520" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Using-SAS-Viya-Data-Step-Score-Code-in-SAS-9-4/ta-p/677520&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;[EDIT]&lt;/STRONG&gt; if you can download the score code, it is saved somewhere. I agree with you that you should be able to %INCLUDE that score code directly. I will try to find out about the location ! Could be next week ... .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2026 21:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/VDMML-SAS-code-node-score-a-model-within-a-data-step/m-p/987542#M11127</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-05-07T21:04:11Z</dc:date>
    </item>
  </channel>
</rss>

