BookmarkSubscribeRSS Feed
ChrisLemberg
Fluorite | Level 6

Hello,

 

I am trying to buld a new custom node. Similar to the prioritize node it should have multiple outputs. Unfortunately it doesn't work.

 

Here my code:

 

%stpbegin;
%maspinit;


%let anzTab=%sysfunc(count(&inputtablelist.,MATables));
*%let anzTab=3;

%put ANZ: &anzTab.;
%global connectstr;

/* Alle Eingangstabellen in eine Tabelle temp00 schreiben */
%macro oneTab;


%let vartab=intable;
%do i=1 %to &anzTab.;
data temp00 (index=(CUSTOMER_ID));
length INTABLE 8.; 
set &&&vartab.&i.;
intable=&I.;
run;
proc append base=INTABLE data=temp00;
run;
%end;

proc sql;
create table temp02 as 
select i1.INTABLE, 
i1.CUSTOMER_ID,
t2.CUSTOMER_HOUSEHOLD__ID,
from intable i1 
inner join
Table2 t2 on i1.CUSTOMER_ID= t2.CUSTOMER_ID

order by
t2.CUSTOMER_HOUSEHOLD__ID,
i1.INTABLE; 
quit;



data temp03 ;
set temp02;
by CUSTOMER_HOUSEHOLD__ID;
if first.CUSTOMER_HOUSEHOLD__ID then output;
run;




%do i=1 %to &anzTab.;
data &outtable&i. (keep=CUSTOMER_ID);
set temp03 (where=(INTABLE=&i.));
run;

%end;


%mend;
%oneTab;






%let OutSubjectId = &InSubjectId.;
%macount(&outtable.);
%mastatus(&_stpwork.status.txt);
%stpend;

 

I hope someone is able to help me.

 

Greetings 

Chris

 

2 REPLIES 2
infomevijay
Obsidian | Level 7

Hi Chris

 

You are updating counts on &outtable which is never created. You are actually creating &outtable1,2,3.

Did you specify output cell keywords while registering the stored process.

Can you share the log when you try to execute your STP?

 

/Vijay

jcawesome
Obsidian | Level 7

Hi Chris,

 

There are a couple of problems with your code:

(1) Since you're expecting to have multiple InTables then you need to reference each of those input tables as Intable1, Intable2, Intable3. The macro Intable would have a value of "Intable1, Intable2, Intable3,..."

(2) Since you're expecting an output of multiple OutTables then you need to use the macr %MACntTab; and not %MACount(outtable.); You can only use the %MACount(outtable.); if you're expecting one output table.

(3) Recheck your iterations and make sure they match the given Input and Output table macros

(4) Test your code in EG first before testing in CI Studio (Declare dummy names for the Intable1,Intable2, ..., Outtable1, Outtable2, ...; remove the CI macros first)

How to improve email deliverability

SAS' Peter Ansbacher shows you how to use the dashboard in SAS Customer Intelligence 360 for better results.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 862 views
  • 0 likes
  • 3 in conversation