Usage Note 24470: How do I use the SAS Code node in SASĀ® Enterprise Miner(tm) to perform my own data manipulations?
This note is intended only as a brief overview. Additional information is given in the SAS Code Node chapter. To access the chapter from within SAS Enterprise Miner, select Help ► Contents ► Node Reference ► Utility Nodes ► SAS Code Node.
You can create a SAS data set from within the SAS Code node by naming the data set in the DATA step that creates it.
Example: you are using a DATA step to create a data set. You can name the data set in the DATA statement as you would in regular SAS programming:
DATA MYLIB.NEW_OUTPUT;
SET SASHELP.CLASS;
IF AGE < 13 then AGEGROUP=1;
ELSE IF AGE >= 13 AND AGE < 16 THEN AGEGROUP=2;
ELSE IF AGE >= 16 THEN AGEGROUP=3;
RUN;
The example uses a previously assigned libref named MYLIB. Use your own libref. You can create your own libref by issuing a LIBNAME statement in the same SAS code node, or in the Project Start Code. The data set MYLIB.NEW_OUTPUT is created by the SAS Code node.
The SAS Code node can also be used to manipulate data that was created by an upstream node, and to make data available to subsequent nodes. In the DATA and SET statements, use specific macro variables that are available in the SAS Code node.
To access these macro variables, select the SAS Code node in your diagram. Select the Code Editor property. In the Training Code - Code Node window that opens, the macro variables are displayed in the Macro Variables tab. Identify the macro name that references the data that you want to read.
Example: you want to modify your training data within the SAS Code node. Scroll through the macro variables that are listed in the Imports section. The macro variable that defines the data from the predecessor node is EM_IMPORT_DATA. Click and drag this name downward into the Training Code panel of the window. The code that you write might look like the following DATA step:
DATA &EM_EXPORT_TRAIN;
SET &EM_IMPORT_DATA;
IF AGE < 13 then AGEGROUP=1;
ELSE IF AGE >= 13 AND AGE < 16 THEN AGEGROUP=2;
ELSE IF AGE >= 16 THEN AGEGROUP=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: | 2016-06-01 13:41:32 |
Date Created: | 2005-12-23 16:47:19 |