# Output developed model to SQL code?

**URL:** <https://forum.knime.com/t/output-developed-model-to-sql-code/13662>\
**Category:** KNIME Analytics Platform\
**Created:** [February 27, 2019, 8:03pm UTC](https://forum.knime.com/t/output-developed-model-to-sql-code/13662 "2019-02-27T20:03:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Jimmy](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/_/e47774/32.png) [@\_Jimmy](https://forum.knime.com/u/_Jimmy)\
**Post date:** [February 27, 2019, 8:03pm UTC](https://forum.knime.com/t/output-developed-model-to-sql-code/13662/1 "2019-02-27T20:03:43Z")

</div>

Hi everyone.

I searched the forum first but couldn’t find an answer because I am sure this question has been asked somewhere. Is there a way to output the model you developed in Knime into SQL code so you can implement it another program such as SAS?

Thanks everyone.

---

<div class="post-metadata">

**Author:** ![izaychik63](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/e9a140/32.png) [@izaychik63](https://forum.knime.com/u/izaychik63)\
**Post date:** [February 27, 2019, 8:12pm UTC](https://forum.knime.com/t/output-developed-model-to-sql-code/13662/2 "2019-02-27T20:12:47Z")

</div>

Look at

> **[PMML to SQL — NodePit](https://nodepit.com/node/org.knime.base.pmml.translation.sql.SQLGeneratorNodeFactory)**
>
> Generates SQL for PMML Decision Trees and Regression models

  
Not sure it will work in SAS.

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [February 27, 2019, 8:33pm UTC](https://forum.knime.com/t/output-developed-model-to-sql-code/13662/3 "2019-02-27T20:33:33Z")

</div>

You can transform several models into PMML and then into SQL. Decision trees can also be transformed into rules that you can then convert into some if then else … rules

For SAS you could try to use PROC SQL and the output code.

> [@Looking for options to evaluate a decision tree](https://forum.knime.com/t/looking-for-options-to-evaluate-a-decision-tree/11384):
>
> Hi, I am currently looking into options to make use of KNIME for a rather small use case. We have a decision tree we want to evaluate but the use case (business case) is too small and isolated to buy and setup KNIME server. My idea was to train the tree, write a PMML file and then use a library within a REST service to make evaluations. To my surprise there do not seem to be too many options at hand: so far I discovered SMILE which does not seem to read PMML files and JPMML(-Evaluator) . Has a…

We discussed which models use PMML here:

> [@Export PMML that outputs class probabilities](https://forum.knime.com/t/export-pmml-that-outputs-class-probabilities/13244/2):
>
> I think it depends on the type of model. Normally you would have to tell the Predictor to add the class probabilities. The generic PMML predictor does not have this function - or it depends on the type of model. Nodes that support Probabilities and PMML are: Additionally the Decision Tree offers the possibility to create a quite readably [ruleset](https://nodepit.com/node/org.knime.base.node.rules.engine.decisiontree.FromDecisionTreeNodeFactory) that you can then use with SQL or another language Additionally the Supports these model types and also has the possibility to…

I think it could be possible to use PMML in SAS (but you would have to check if it works, PROC PSCORE); keep in mind that you will have to include all the data transformations also. From my experience PMML is compatible in theory but once you start implementing real models you have to put in some effort.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 23, 2023, 8:32pm UTC](https://forum.knime.com/t/output-developed-model-to-sql-code/13662/4 "2023-06-23T20:32:48Z")

</div>


