input and output variable in DS2 in SAS customer intelligence studio

Reply
New Contributor
Posts: 3

input and output variable in DS2 in SAS customer intelligence studio

Hi all, I am trying to add a DS2 code inside SAS customer intelligence studio. The original code' structure is like below:

 

 

package sample1 /overwrite=yes;
declare package .....;
method execute( double var1 , double var3, varchar(1) var4, in_out double var1, in_out double var2, );

var2 = var1;


If var4 = 'Y' then var1 = var3

end; 
endpackage;
run;
Quit;


However, I was told by my colleague that the variable var1 shouldn't be used for both input and output in DS2 in customer intelligence studio since it may cause production bugs.
As a result, I divided the code into two files and let customer intelligence studio execute the code in the sequence:

 

file1:

package step1 /overwrite=yes;
declare package .....;
method execute( double var1 , in_out double var2, );

var2 = var1;
......


file2:

 

package step2 /overwrite=yes;
declare package .....;
method execute( double var3, varchar(1) var4, in_out double var1 );

If var4 = 'Y' then var1 = var3
.....

 

When var4 = 'Y', the results are totally fine. Logically, when var4 = 'N', the data set is supposed to just pass the file2 without any execution.  However, var1 is set as empty when var4 = 'N'. I wonder if var1 has been re-initialized even
if the condition didn't pass. Any comments or suggestions? Thanks very much!

Ask a Question
Discussion stats
  • 0 replies
  • 286 views
  • 0 likes
  • 1 in conversation