How do I manipulate value of "next" observation in Column Cumulative New Tuition ( ? ?) Student Course Course Rank Tution Cumulative Tuition (Calculated) New Tution Cummulative New Tution (Calculated) Actual Total Tution Target - 1 Flag1 Actual Total Tution Target - 2 Flag2 123 BIO 2 900 900 1000 1000 2500 Process 2800 Process 123 CHE 2 200 1100 300 1300 2500 Process 2800 Process 123 ENG 3 700 1800 800 2100 2500 Process 2800 Process 123 PHY 3 500 2300 500 2600 2500 CALC 2800 Process 123 MAT 4 300 2600 300 2900 2500 STOP 2800 CALC 123 BUS 4 400 3000 400 3300 2500 STOP 2800 STOP 123 COM 5 500 3500 1000 4300 2500 STOP 2800 STOP Total Tuition Fees =3500 Actual Total Tution Target1 = 2500 Actual Total Tution Target2 = 2800 Within Each Course rank, if NEW cumulative Target tuition fee is < Actual Targeted Tuition Fee, Populate Flag ="Process" if NEW cumulative Target tuition fee is > Actual Total Tuition Fee then, populate Flag = "CALC" else populate flag = "STOP" I don't know how to populate Value "CALC" and "STOP" (below is my logic but it populates "CALC" for every record after Course "PHY" Data test; set test; by student course course_rank; array flag{2} flag1 - flag2; if Cummulative New Tution (Calculated){i} < Actual Total Tution Target{i} then do; Flag{i} = "Process" ; end; else do; if first.course_rank then do; Flag{i} = "CALC" ; end; else do; Flag{i} = "STOP" ; end; end; run; What I am doing wrong ? why Flag{i} sets to "CALC" for rest of the rows. I am guessing somehow I need counter or way to move to "Next" Observation. Please Help
... View more