From: gsal on
Hi,

I just started a course in EM, with only a little SAS programming code
experience. I need to add a SAS Code Node to my model, in which I
create a new variable. I cannot get the Code to run without error, and
I believe my problem is with the DATA step. Within the EM Code Node,
am I supposed to refer to the original dataset on my C: drive in the
DATA step, or, somehow to the dataset in my model (diagram)? (e.g.,
something like "&EM_TRAIN_DATA) Like I said, nothing I do seems to
work, so I wonder if anyone has any hints for such an elemental
problem.


One example of my code, I don't know if the SET is necessary, or a
LIBNAME, I've tried bunched of combinations with different names of
datasets:

data EMWS.Impt_TRAIN;
set EMWS.Impt_TRAIN;
ltv=loan/imp_value;
run;

proc print data=EMWS.Impt_TRAIN;
var ltv;
run;



And the errors, looks like part of the complaint is that
EMWS.Impt_TRAIN already exists, but nothing I try works.

NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


5 %global emexceptionstring;
6 %let EMUSERID = %bquote(mgsalazar);
7 %let EMLDSPATH = %bquote(C:\Documents and Settings\mgsalazar\My
Documents\My SAS Files\9.1\EM_Projects\Homework 1\DataSources);
8 %let EMFLOWMODE = Y;
9 %let EMONODE = %bquote(EMCODE);
10 %let EMPATH = %bquote(C:\Documents and Settings\mgsalazar\My
Documents\My SAS Files\9.1\EM_Projects\Homework 1\Workspaces\EMWS);
11 %let EMWS = EMWS;
12 %let EMNODECLASS = SASHELP.EMCORE.EMCODETOOL.CLASS;
13 %let EMSTATUSDIR = %bquote(C:\Documents and Settings\mgsalazar\My
Documents\My SAS Files\9.1\EM_Projects\Homework 1\Workspaces\EMWS
\System);
14 %let EM_DEBUG = N;
15 %let EMPROJECTCODE = %bquote(C:\Documents and Settings\mgsalazar
\My Documents\My SAS Files\9.1\EM_Projects\Homework 1\System
\STARTUP.sas);
16 %let EMSERVERCODE = %bquote();
17 %let EM_USERID = %bquote(mgsalazar);
18 %let EM_METAHOST = E1505-SAL;
19 %let EM_METAPORT = 8561;
20 %let EM_JAVAPACKAGE = %bquote();
21 %let emexceptionstring=;
22 %em5run();

*------------------------------------------------------------*
*
* EMCODE : Running
* datetime : 16SEP2007:14:02:30
*
*------------------------------------------------------------*
EM_DEBUG: 16SEP2007:14:02:30.58
2253 proc freq data=EMWS.EMCODE_VariableSet noprint;
2254 table ROLE*LEVEL/out=WORK.EMCODEMETA;
2255 run;

NOTE: There were 25 observations read from the data set
EMWS.EMCODE_VARIABLESET.
NOTE: The data set WORK.EMCODEMETA has 5 observations and 4 variables.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


2256 proc print data=WORK.EMCODEMETA noobs;
2257 var ROLE LEVEL COUNT;
2258 title9 ' ';
2259 title10 'Variable Summary';
2260 run;

NOTE: There were 5 observations read from the data set
WORK.EMCODEMETA.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


2261 title10;

2262 data EMWS.EMCODE_EMTRAINVARIABLE;
2263 set EMWS.EMCODE_VariableSet;
2264 drop order--length;
2265 run;

NOTE: There were 25 observations read from the data set
EMWS.EMCODE_VARIABLESET.
NOTE: The data set EMWS.EMCODE_EMTRAINVARIABLE has 25 observations and
4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


4390 *------------------------------------------------------------*;
4391 * EMCODE: Generation of macros and macro variables;
4392 * To see the code generated, set the EM_DEBUG macro variable to
SOURCE or _ALL_;
4393 *------------------------------------------------------------*;
4394 *------------------------------------------------------------*;
4395 * EMCODE: User Code;
4396 *------------------------------------------------------------*;
NOTE: View EMWS.IMPT_TRAIN.VIEW used (Total process time):
real time 0.14 seconds
cpu time 0.00 seconds

4397 data EMWS.Impt_TRAIN;
4398 set EMWS.Impt_TRAIN;
ERROR: The variable ltv from data set HW1.HMEQ is not defined in the
INPUT view EMWS.IDS_DATA.
ERROR: The variable imp_value from data set HW1.HMEQ is not defined in
the INPUT view EMWS.IDS_DATA.
ERROR: Failure loading view EMWS.IDS_DATA.VIEW. Error detected during
View Load request.
ERROR: Failure loading view EMWS.IMPT_TRAIN.VIEW. Error detected
during View Load request.
4399 ltv=loan/imp_value;
4400 run;

ERROR: Unable to create EMWS.IMPT_TRAIN.DATA because
EMWS.IMPT_TRAIN.VIEW already exists.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.21 seconds
cpu time 0.00 seconds


NOTE: View EMWS.IMPT_TRAIN.VIEW used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

4401 proc print data=EMWS.Impt_TRAIN;
ERROR: The variable ltv from data set HW1.HMEQ is not defined in the
INPUT view EMWS.IDS_DATA.
ERROR: The variable imp_value from data set HW1.HMEQ is not defined in
the INPUT view EMWS.IDS_DATA.
ERROR: Failure loading view EMWS.IDS_DATA.VIEW. Error detected during
View Load request.
ERROR: Failure loading view EMWS.IMPT_TRAIN.VIEW. Error detected
during View Load request.
4402 var ltv;
4403 run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


EM_DEBUG: 16SEP2007:14:02:31.69
EM_DEBUG: 16SEP2007:14:02:31.69
*------------------------------------------------------------*
*
* ERROR: EXCEPTION.SERVER.CODETOOL.RUNTIMEERROR
* Please report unresolved problems to Technical Support.
*
*------------------------------------------------------------*
*------------------------------------------------------------*
*
* EMCODE : End run
* datetime : 16SEP2007:14:02:32
*
*------------------------------------------------------------*
ERROR: Exception thrown.
CODETOOL.RUNTIMEERROR,3000 in SASHELP.EMCORE.TOOLDRIVER.SCL at line
989.
Program returning prematurely at line 197
AF Program: SASHELP.EMCORE.RUNNODEDETACH.SCL
NOTE: The PROCEDURE DISPLAY printed page 1.
NOTE: PROCEDURE DISPLAY used (Total process time):
real time 2.09 seconds
cpu time 1.20 seconds


4408 %put &&emexceptionstring;
exception.server.CODETOOL.RUNTIMEERROR,3000
4409 %sysrput emerror_EMCODE = &&emexceptionstring;
4410 proc printto;
4411 run;

From: "Howard Schreier <hs AT dc-sug DOT org>" on
On Sun, 16 Sep 2007 11:10:06 -0700, gsal <salgerman(a)GMAIL.COM> wrote:

>Hi,
>
>I just started a course in EM, with only a little SAS programming code
>experience. I need to add a SAS Code Node to my model, in which I
>create a new variable. I cannot get the Code to run without error, and
>I believe my problem is with the DATA step. Within the EM Code Node,
>am I supposed to refer to the original dataset on my C: drive in the
>DATA step, or, somehow to the dataset in my model (diagram)? (e.g.,
>something like "&EM_TRAIN_DATA) Like I said, nothing I do seems to
>work, so I wonder if anyone has any hints for such an elemental
>problem.
>
>
>One example of my code, I don't know if the SET is necessary, or a
>LIBNAME, I've tried bunched of combinations with different names of
>datasets:
>
>data EMWS.Impt_TRAIN;
> set EMWS.Impt_TRAIN;

It appears that the existing data set referenced in the SET statement is a
view. The new data set designated by the DATA statement has the same name
but a different type (table rather than view). A view cannot be overwritten
by a table having the same name.

> ltv=loan/imp_value;
>run;
>
>proc print data=EMWS.Impt_TRAIN;
> var ltv;
>run;
>
>
>
>And the errors, looks like part of the complaint is that
>EMWS.Impt_TRAIN already exists, but nothing I try works.
>
>NOTE: PROCEDURE PRINTTO used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
>
>
>5 %global emexceptionstring;
>6 %let EMUSERID = %bquote(mgsalazar);
>7 %let EMLDSPATH = %bquote(C:\Documents and Settings\mgsalazar\My
>Documents\My SAS Files\9.1\EM_Projects\Homework 1\DataSources);
>8 %let EMFLOWMODE = Y;
>9 %let EMONODE = %bquote(EMCODE);
>10 %let EMPATH = %bquote(C:\Documents and Settings\mgsalazar\My
>Documents\My SAS Files\9.1\EM_Projects\Homework 1\Workspaces\EMWS);
>11 %let EMWS = EMWS;
>12 %let EMNODECLASS = SASHELP.EMCORE.EMCODETOOL.CLASS;
>13 %let EMSTATUSDIR = %bquote(C:\Documents and Settings\mgsalazar\My
>Documents\My SAS Files\9.1\EM_Projects\Homework 1\Workspaces\EMWS
>\System);
>14 %let EM_DEBUG = N;
>15 %let EMPROJECTCODE = %bquote(C:\Documents and Settings\mgsalazar
>\My Documents\My SAS Files\9.1\EM_Projects\Homework 1\System
>\STARTUP.sas);
>16 %let EMSERVERCODE = %bquote();
>17 %let EM_USERID = %bquote(mgsalazar);
>18 %let EM_METAHOST = E1505-SAL;
>19 %let EM_METAPORT = 8561;
>20 %let EM_JAVAPACKAGE = %bquote();
>21 %let emexceptionstring=;
>22 %em5run();
>
>*------------------------------------------------------------*
>*
>* EMCODE : Running
>* datetime : 16SEP2007:14:02:30
>*
>*------------------------------------------------------------*
>EM_DEBUG: 16SEP2007:14:02:30.58
>2253 proc freq data=EMWS.EMCODE_VariableSet noprint;
>2254 table ROLE*LEVEL/out=WORK.EMCODEMETA;
>2255 run;
>
>NOTE: There were 25 observations read from the data set
>EMWS.EMCODE_VARIABLESET.
>NOTE: The data set WORK.EMCODEMETA has 5 observations and 4 variables.
>NOTE: PROCEDURE FREQ used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
>
>
>2256 proc print data=WORK.EMCODEMETA noobs;
>2257 var ROLE LEVEL COUNT;
>2258 title9 ' ';
>2259 title10 'Variable Summary';
>2260 run;
>
>NOTE: There were 5 observations read from the data set
>WORK.EMCODEMETA.
>NOTE: The PROCEDURE PRINT printed page 1.
>NOTE: PROCEDURE PRINT used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
>
>
>2261 title10;
>
>2262 data EMWS.EMCODE_EMTRAINVARIABLE;
>2263 set EMWS.EMCODE_VariableSet;
>2264 drop order--length;
>2265 run;
>
>NOTE: There were 25 observations read from the data set
>EMWS.EMCODE_VARIABLESET.
>NOTE: The data set EMWS.EMCODE_EMTRAINVARIABLE has 25 observations and
>4 variables.
>NOTE: DATA statement used (Total process time):
> real time 0.01 seconds
> cpu time 0.01 seconds
>
>
>4390 *------------------------------------------------------------*;
>4391 * EMCODE: Generation of macros and macro variables;
>4392 * To see the code generated, set the EM_DEBUG macro variable to
>SOURCE or _ALL_;
>4393 *------------------------------------------------------------*;
>4394 *------------------------------------------------------------*;
>4395 * EMCODE: User Code;
>4396 *------------------------------------------------------------*;
>NOTE: View EMWS.IMPT_TRAIN.VIEW used (Total process time):
> real time 0.14 seconds
> cpu time 0.00 seconds
>
>4397 data EMWS.Impt_TRAIN;
>4398 set EMWS.Impt_TRAIN;
>ERROR: The variable ltv from data set HW1.HMEQ is not defined in the
>INPUT view EMWS.IDS_DATA.
>ERROR: The variable imp_value from data set HW1.HMEQ is not defined in
>the INPUT view EMWS.IDS_DATA.
>ERROR: Failure loading view EMWS.IDS_DATA.VIEW. Error detected during
>View Load request.
>ERROR: Failure loading view EMWS.IMPT_TRAIN.VIEW. Error detected
>during View Load request.
>4399 ltv=loan/imp_value;
>4400 run;
>
>ERROR: Unable to create EMWS.IMPT_TRAIN.DATA because
>EMWS.IMPT_TRAIN.VIEW already exists.
>NOTE: The SAS System stopped processing this step because of errors.
>NOTE: DATA statement used (Total process time):
> real time 0.21 seconds
> cpu time 0.00 seconds
>
>
>NOTE: View EMWS.IMPT_TRAIN.VIEW used (Total process time):
> real time 0.01 seconds
> cpu time 0.01 seconds
>
>4401 proc print data=EMWS.Impt_TRAIN;
>ERROR: The variable ltv from data set HW1.HMEQ is not defined in the
>INPUT view EMWS.IDS_DATA.
>ERROR: The variable imp_value from data set HW1.HMEQ is not defined in
>the INPUT view EMWS.IDS_DATA.
>ERROR: Failure loading view EMWS.IDS_DATA.VIEW. Error detected during
>View Load request.
>ERROR: Failure loading view EMWS.IMPT_TRAIN.VIEW. Error detected
>during View Load request.
>4402 var ltv;
>4403 run;
>
>NOTE: The SAS System stopped processing this step because of errors.
>NOTE: PROCEDURE PRINT used (Total process time):
> real time 0.01 seconds
> cpu time 0.01 seconds
>
>
>EM_DEBUG: 16SEP2007:14:02:31.69
>EM_DEBUG: 16SEP2007:14:02:31.69
>*------------------------------------------------------------*
>*
>* ERROR: EXCEPTION.SERVER.CODETOOL.RUNTIMEERROR
>* Please report unresolved problems to Technical Support.
>*
>*------------------------------------------------------------*
>*------------------------------------------------------------*
>*
>* EMCODE : End run
>* datetime : 16SEP2007:14:02:32
>*
>*------------------------------------------------------------*
>ERROR: Exception thrown.
>CODETOOL.RUNTIMEERROR,3000 in SASHELP.EMCORE.TOOLDRIVER.SCL at line
>989.
>Program returning prematurely at line 197
>AF Program: SASHELP.EMCORE.RUNNODEDETACH.SCL
>NOTE: The PROCEDURE DISPLAY printed page 1.
>NOTE: PROCEDURE DISPLAY used (Total process time):
> real time 2.09 seconds
> cpu time 1.20 seconds
>
>
>4408 %put &&emexceptionstring;
>exception.server.CODETOOL.RUNTIMEERROR,3000
>4409 %sysrput emerror_EMCODE = &&emexceptionstring;
>4410 proc printto;
>4411 run;