Delete cases with offset cases
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | */////////////////////////. DEFINE !offset (test1=!TOKENS(1) /test2=!TOKENS(1) /id=!TOKENS(1) /date=!TOKENS(1)) /* To delete claims whose amount submitted have been reversed */ COMPUTE abs_1=ABS(!test1). COMPUTE abs_2=ABS(!test2). * Identify offset cases. SORT CASES BY !id !date !test1 abs_1 !test2 abs_2. COMPUTE id_no=$CASENUM. IF (!id=LAG(!id) AND !date=LAG(!date) AND !test1=-lag(!test1) AND !test2=-lag(!test2)) flag=1. * Identify case being offset. SORT CASES BY id_no(D). IF LAG(flag)=1 flag2=1. COMPUTE flag3=SUM.1(flag,flag2). EXECUTE. TEMPORARY. SELECT IF flag3>0. LIST cert age sexe !date din soumis net. * Select only records you want to keep then clean file. SELECT IF MISSING(flag3). MATCH FILES FILE=* /DROP=abs_1 id_no flag flag2 flag3. EXECUTE. !ENDDEFINE. */////////////////////////. RESTORE. |
Related pages
...