Usage Note 24469: How do I use the Code node in the SAS® Enterprise Miner™ 4.x series to perform my own data manipulations?
When you use the Code node to perform a data manipulation, use the defined macro variables to reference the input and output data sets. This ensures the data is read and written with names that SAS Enterprise Miner maintains. Use the Import Data Set macro names for reading your data, such as with a SET statement. Use the Export Data Set macro names for writing your data, such as with a DATA statement.
The Macros tab in the Code node displays the currently defined macros. Identify the macro name that references the data that you want to read. For example, if you intend to modify your training data within the Code node, find the macro variable with the description "Import: Train data set". This name is likely &_TRAIN or &_MAC_1.
By default, the Code node doesn't create export tables. To define the macro variable that identifies the data that you want to create with your code, select the Exports tab, and then select Add. Select Export Role from the menu, and then click OK. A new macro variable is added to the list. For example, if you selected to export (or create) a data set that has a Training role, then the macro variable &_TRA is created. Its description reads "Export: Train data set".
When you know the macro variables to use, you can write your code. Remember that the import table is the data that comes into the node. The export table is the final form of the data when the node is done. Your code might look something like this:
DATA &_TRA;
SET &_TRAIN;
IF X <= 10 then X=1;
ELSE IF X > 10 AND x < 100 THEN X=2;
ELSE IF X >= 100 THEN X=3;
RUN;
Operating System and Release Information
| SAS System | SAS Enterprise Miner | All | n/a | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | low |
| Topic: | Analytics ==> Power and Sample Size Analytics ==> Data Mining
|
| Date Modified: | 2008-12-24 11:10:50 |
| Date Created: | 2005-12-23 16:42:30 |