8 Replies Latest reply: Jul 5, 2016 6:25 PM by Vishnu Chakrakishore RSS

    Which code is more efficient for binning ages? For the aficionado's........

    Vishnu Chakrakishore

      Hi!

       

      I want to bin age into the agegroup "0-20", "21-30" etc.. For that

       

      1. Would a Nested IF statement be taking more toll on memory OR

       

      2. This:


       

       

      let Max_Age = 69;

       

       

      For a = 1 to 20

      A:

      LOAD $(a) as AgeNumber, '0-20' as [Age Group]

      AutoGenerate 1;

      Next

       

       

      For a = 21 to 30

      Concatenate LOAD $(a) as AgeNumber, '21-30' as [Age Group]

      AutoGenerate 1;

      Next

       

       

      For a = 31 to 40

      concatenate LOAD $(a) as AgeNumber, '31-40' as [Age Group]

      AutoGenerate 1;

      Next

       

       

      For a = 41 to 50

      concatenate LOAD $(a) as AgeNumber, '41-50' as [Age Group]

      AutoGenerate 1;

      Next

       

       

      For a = 51 to 60

      concatenate LOAD $(a) as AgeNumber, '51-60' as [Age Group]

      AutoGenerate 1;

      Next

       

       

      For a = 61 to $(Max_Age)

      concatenate LOAD $(a) as AgeNumber, '60+' as [Age Group]

      AutoGenerate 1;

      Next