Hi Bhanu, The Data Process does not support mapping List type variables as an input to a criteria variable. To achieve what you want you would need to create a SAS process using DS2 code (or using Groovy or Jython), to accept a List and then translate that into a IN clause in the SQL query. Your first query that retrieves the initial list is OK, then downstream from it add a Process Node. An example of the type of DS2 code you would need is below. Note the FedServer only supports 16 values in an IN Clause. This code essentially loops through the String List, and builds the IN Clause with the values from the list. It returns a flag to indicate if the customer has one or more of the input products, you can modify this for your needs. HTH, James package CheckCustomerProducts / overwrite=yes; /** This package will support up to 16 values for the IN CLAUSE. **/ /** FedServer throws a SQL prepare error if more than 16 parameters are passed in the IN clause **/ /** If the products list contains > 16 items, only the first 16 are used. The remainder will be ignored **/ dcl package tap_logger m_logger(); dcl package sqlstmt m_sqlstatement('select CustomerID, prod_nm from {Catalog}.{Schema}.{SomeTable} where CustomerID = ? AND prod_nm IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)') ; method execute( double CustomerID, package tap_string_array products, in_out Integer HasProducts); dcl int i size rc ; dcl int param_num ; dcl int m_maxBind; dcl double startDTTM endDTTM elapsedTime; m_maxBind = 16 ; if (m_logger.isDebugEnabled()) then do; startDTTM=datetime() ; m_logger.debug(catt('CheckCustomerProducts: Entered execute method for CustomerID: ',CustomerID)); end ; size = products.size(); if size > 0 then do; if (m_logger.isDebugEnabled()) then do ; if (size > m_maxBind) then m_logger.debug('CheckCustomerProducts: Product list has '||size||' items. Only the first '||m_maxBind||' values will be used.'); else m_logger.debug('CheckCustomerProducts: Product list has '||size||' items.'); end ; m_sqlstatement.setdouble(1,CustomerID); param_num = 1 ; /** Set parameters from list up to the value of m_maxBind or size of list **/ do while (param_num <= size and param_num <= m_maxBind) ; m_sqlstatement.setchar(1+param_num, products.get(param_num)); param_num = param_num + 1 ; end ; /** If size is smaller than m_maxBind, fill remaining parameters with last value in list **/ do while (param_num <= m_maxBind) ; m_sqlstatement.setchar(1+param_num, products.get(size)); param_num = param_num + 1 ; end ; m_sqlstatement.execute(); rc = m_sqlstatement.fetch(); if rc = 0 then do; /* successful fetch therefore has products*/ HasProducts = 1; if (m_logger.isDebugEnabled()) then m_logger.debug('CheckCustomerProducts: FETCH returned records therefore HasProducts = '||HasProducts); end; else if rc = 1 then do; /* ERROR unsuccessful fetch therefore has NO products*/ HasProducts = 0; if (m_logger.isDebugEnabled()) then m_logger.debug('CheckCustomerProducts: FETCH returned ERROR therefore HasProducts = '||HasProducts); end; else if rc = 2 then do; /* NODATA therefore has NO products*/ HasProducts = 0; if (m_logger.isDebugEnabled()) then m_logger.debug('CheckCustomerProducts: FETCH returned NODATA therefore HasProducts = '||HasProducts); end; end; else do; HasProducts=0; if (m_logger.isDebugEnabled()) then do ; endDTTM = datetime() ; elapsedTime=endDTTM - startDTTM ; m_logger.debug('CheckCustomerProducts: No Products to search for provided. Exiting DS2 process'); end ; end; if (m_logger.isDebugEnabled()) then do ; endDTTM = datetime() ; elapsedTime=endDTTM - startDTTM ; m_logger.debug('CheckCustomerProducts: Execution time for CustomerID '||CustomerID|| ' is '||left(put(elapsedTime*1000, COMMA6.2))||'ms.'); end ; end; /** execute method **/ endpackage; run;
... View more