1 Reply Latest reply: Jun 7, 2016 4:38 AM by Stefan Wühl RSS

    Creating a New Variable



      I would like to create a new variable by client ID


      I have four separate Columns by Client ID and I would like to create a new variable that sums the information by client ID.


      The column headings are:

      1. Cross sell lending products

      2. CA Flag

      3. SBA Flag

      4. TD Flag


      Can you please help me to aggregate the 4 functions by client ID and to create a new variable that will be called revised_cross_sell?


      Thank you!

        • Re: Creating a New Variable
          Stefan Wühl

          you can aggregate the fields using a resident LOAD with a group by clause:




               Concat([Cross sell lending products]) as AggrLendingProducts,

               Max([CA Flag]) as MaxCAFlag,

               Only([SBA Flag]) as OnlySBAFLag,

               Sum([TD Flag]) as SumTDFlag

          RESIDENT YourTable

          GROUP BY ID;


          The aggregation functions Concat,Max,Only, Sum are just examples, since I don't know how you want to aggregate the field values. Chose a script aggregation function appropriate for your requirements.