简体   繁体   中英

How to define a macro variable using equation with variables from dataset in SAS Miner

I am trying to use &let in the beginning of my script to define a new macro variable... it should consist of equation from variables from dataset. The equation looks something like this, but SAS always gives me error like this (Runtime error was encountered, please see the log...).

The equation:

%let var_bad = (receivable_actual * 0.5) - 
               (EM_EVENTPROBABILITY * 0.02 * receivable_actual) + 
               ((1 - EM_EVENTPROBABILITY) * 0.5 * (receivable_actual - amt_instalment));

Can you guys help me fix it?

Thanks, Adam

@Jetzler: These are the errors it shows me in log.

ERROR 214-322: Variable name ( is not valid.

ERROR 22-7: Invalid option name -.

ERROR 23-7: Invalid value for the KEEP option.

                         ---
                         23

1 ! (receivable_actual * 0.5) - (EM_EVENTPROBABILITY * 0.02 * receivable_actual) + ((1 - EM_EVENTPROBABILITY) * 0.5 * (receivable_actual - amt_instalment)) - - 214 22 ERROR 214-322: Variable name * is not valid.

ERROR 22-7: Invalid option name +.

1 ! (receivable_actual * 0.5) - (EM_EVENTPROBABILITY * 0.02 * receivable_actual) + ((1 - EM_EVENTPROBABILITY) * 0.5 * (receivable_actual - amt_instalment)) --- - 214 22 14338 + rename=(em_eventprobability = score_no_call)); ------- 22 22 201 76 ERROR 214-322: Variable name 0.5 is not valid.

ERROR 22-7: Invalid option name *.

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, -, :, ;, END, INDSNAME, KEY, KEYS, NOBS, OPEN, POINT, DATA , LAST , NULL .

ERROR 201-322: The option is not recognized and will be ignored.

ERROR 76-322: Syntax error, statement will be ignored.

为什么不只计算数据集中的变量,然后将其选择为宏变量?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM