-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScore_Education.ecl
35 lines (32 loc) · 1.84 KB
/
Score_Education.ecl
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
31
32
33
34
35
IMPORT $;
//score assignment
lm:=$.Analyse_Education.lm;
MYREC9:=RECORD
lm.state;
lm.PrimaryPTRratio;
lm.SecondaryPTRratio;
lm.TotalPrimary;
lm.TotalSecondary;
lm.TotalSchools;
lm.Total_Students;
lm.StudentsPerSchool;
lm.LiteracyRate;
UNSIGNED LiteracyScore:=0;
UNSIGNED PrimPTRScore:=0;
UNSIGNED SecPTRScore:=0;
UNSIGNED StudentPerSchoolScore:=0
END;
Edu_With_Scores1:=TABLE(lm, myRec9);
LitScore:=ITERATE(SORT(Edu_With_Scores1,LiteracyRate),TRANSFORM(myRec9,
SELF.LiteracyScore := IF(LEFT.LiteracyRate=RIGHT.LiteracyRate,LEFT.LiteracyScore,LEFT.LiteracyScore+1),
SELF := RIGHT));
PriPTRScore:=ITERATE(SORT(LitScore,-PrimaryPTRratio),TRANSFORM(myRec9,
SELF.PrimPTRScore := IF(LEFT.PrimaryPTRratio=RIGHT.PrimaryPTRratio,LEFT.PrimPTRScore,LEFT.PrimPTRScore+1),
SELF := RIGHT));
SecPTRSc:=ITERATE(SORT(PriPTRScore,-SecondaryPTRratio),TRANSFORM(myRec9,
SELF.SecPTRScore := IF(LEFT.SecondaryPTRratio=RIGHT.SecondaryPTRratio,LEFT.SecPTRScore,LEFT.SecPTRScore+1),
SELF := RIGHT));
Final_Edu_Data:=ITERATE(SORT(SecPTRSc,-StudentsPerSchool),TRANSFORM(myRec9,
SELF.StudentPerSchoolScore := IF(LEFT.StudentsPerSchool=RIGHT.StudentsPerSchool,LEFT.StudentPerSchoolScore,LEFT.StudentPerSchoolScore+1),
SELF := RIGHT));
OUTPUT(Final_Edu_Data,,'~class::RDT::INTRO::FinalEduData',NAMED('EduScore'),OVERWRITE);