SAS Enterprise Miner does not 'optimize' code per say but it does monitor the variables being passed through the process so that (in general) only the code involving necessary variables is included. It is possible that some data preparation methods (e.g. Tree imputation) might require variables for imputation that were not actually used in the model. Some transformations such as principal components involve many variables that might not be used in the final model yet they would all be required if they were needed for a principal component.
In the SAS Code node, there are sections for training code and for scoring code. The code you place in the Score code section of the SAS Code node will be included in the code captured by the Score node. Are you creating new variables in the SAS Code node? If so, is it possible to create them in a standard node such as the Transform Variables node? If not, what code are you running in the SAS Code node? Please note that the Score code is designed for transformations that can be done in a single data step. If your code requires more than one data step and/or requires a procedure step, it is possible you will not be able to generate optimized score code.
If you can share your flow and the code, we could likely respond more specifically.
Cordially,
Doug
... View more